TOC - Adavnced Sheet - 2023
TOC - Adavnced Sheet - 2023
ADVANCED
THEORY OF COMPUTATION
Q2. [MSQ]
Which of the following language(s) is/are Context-Free language?
(a) L = 𝑎𝑚 𝑏𝑛 𝑥𝑑𝑘 𝑒 𝑝 |𝑚 = 𝑝, 𝑛 = 𝑘 𝑎𝑛𝑑 𝑥 = 𝑏 𝑜𝑟 𝑑 ; 𝑤𝑒𝑟𝑒 𝑚, 𝑛, 𝑝, 𝑘 ≥ 0
(b) L = 𝑤𝑤𝑐𝑤 𝑟 𝑤 𝑟 | 𝑤𝜖 𝑎, 𝑏 ∗ 𝑎𝑛𝑑 𝑤 𝑟 𝑟𝑒𝑝𝑟𝑒𝑠𝑒𝑛𝑡𝑠 𝑡𝑒 𝑟𝑒𝑣𝑒𝑟𝑠𝑒 𝑜𝑓 𝑤
(c) L = 0𝑛 00 𝑛
000 2𝑛
|𝑛 ≥0
(d) L = 𝑎𝑛 𝑏𝑏 𝑛
𝑎𝑎𝑎 2𝑛
|𝑛 ≥0
Q3. [MSQ]
Which of the following statement is/are true about pumping lemma for regular
language?
(a) If L is regular then Pumping lemma must be satisfied.
(b) If the Pumping lemma is not satisfied for the language L (for every possible
division of w = xyz; where w 𝜖 L) then L is definitely non-regular.
2
(c) If L = 𝑎𝑖 | 𝑖 ≥ 0 then pumping lemma is always satisfied for L*.
(d) If L = 𝑎2𝑛 𝑏3𝑚 | 𝑛, 𝑚 > 0 then pumping length can be 5.
Q4. [MSQ]
Which of the following statement is/are true?
(a) If L = 𝑎𝑏 𝑛 𝑎𝑘 : 𝑛 > 𝑘 𝑎𝑛𝑑 𝑘 ≥ 0 then L is non-regular.
(b) If L = 𝑎𝑛 𝑏𝑘 𝑐 𝑛+𝑘 : 𝑛 ≥ 0 𝑎𝑛𝑑 𝑘 ≥ 0 then complement of L is DCFL.
(c) If L = 𝑤𝜖 𝑎, 𝑏 ∗ : 𝑛𝑎 𝑤 = 𝑛𝑏 𝑤 then L* is regular.
(d) If L = {𝑎𝑛 | 𝑛 ≥ 0; 𝑛 𝑖𝑠 𝑛𝑒𝑖𝑡𝑒𝑟 𝑝𝑒𝑟𝑓𝑒𝑐𝑡 𝑠𝑞𝑢𝑎𝑟𝑒 𝑛𝑜𝑟 𝑐𝑢𝑏𝑒} and 𝐿 is the complement
of L then L* is regular. Assume L is defined over {a}.
Q6. [MSQ]
Which of the following statements is/are True?
(a) The intersection of a context free language with a regular language is
context free.
(b) The intersection of non-regular language and context free language is
always non-regular language.
(c) The concatenation of a context free language and the complement of a
regular language is context free.
(d) The concatenation of two non-regular languages may be a regular
language.
Q7. [MSQ]
Let L = 𝐴 | A is a DFA and L A is an infinite language ; where (A) denotes the
description of the deterministic finite automata (DFA). Then which of the
following statement is/are true about L?
(a) It is context-free but not regular.
(b) It is Turing decidable (recursive).
(c) It is Turing recognizable.
(d) Its complement is Turing recognizable.
Q10. [MSQ]
Which of the following languages are not Recursive?
(a) L = < 𝐺 > |𝐺 𝑖𝑠 𝑎 𝐶𝐹𝐺 𝑎𝑛𝑑 𝑅 𝑖𝑠 𝑎 𝑟𝑒𝑔𝑢𝑙𝑎𝑟 𝑠𝑒𝑡 𝑠𝑢𝑐 𝑡𝑎𝑡 𝐿 𝐺 = 𝑅
(b) L = < 𝐺 > |𝐺 𝑖𝑠 𝑎 𝐶𝐹𝐺 𝑠𝑢𝑐 𝑡𝑎𝑡 𝐿 𝐺 = ∅
(c) L = < 𝐺1 , 𝐺2 > |𝐺𝑖 𝑖𝑠 𝑎 𝐶𝐹𝐺 𝑠𝑢𝑐 𝑡𝑎𝑡 𝐿 𝐺1 ∩ 𝐿 𝐺2 = ∅
(d) L = < 𝐺1 , 𝐺2 > |𝐺𝑖 𝑖𝑠 𝑎 𝐶𝐹𝐺 𝑠𝑢𝑐 𝑡𝑎𝑡 𝐿 𝐺1 = 𝐿 𝐺2
Q11. [MSQ]
Which of the following statements is/are False?
(a) If L is context-free language and M is DCFL then L – M is CFL.
(b) If L is DCFL and M is CFL then L – M is CFL.
(c) If L and M are DCFL then 𝐿 ∩ 𝑀 is CFL.
(d) The subset of a decidable language is always decidable.
Q12. [MSQ]
If L is consist of all binary strings beginning with a ‘1’ such that its value when
converted to decimal is divisible by 5, then which of the following statement
is/are true?
(a) L can be recognized by a deterministic finite state automaton.
(b) L can be recognized by a non-deterministic finite state automaton.
(c) L can be recognized by a deterministic push-down automaton
(d) L can be recognized by a non-deterministic push-down automaton but not
by a deterministic push-down automaton.
Q14. [MSQ]
Let 𝑎𝑖 denote a sequence a.a.a…a with 𝒊letters and let N be the set of natural
numbers {1, 2, 3 …}.
Consider the following four languages:
2
𝐿1 = 𝑎𝑖 𝑏𝑖 | 𝑖 ∈ 𝑁 ,
2
𝐿2 = 𝑎𝑖 | 𝑖 ≥ 0 ,
𝐿3 = 𝑎𝑝 | 𝑒𝑖𝑡𝑒𝑟 𝑝 𝑖𝑠 𝑎 𝑝𝑟𝑖𝑚𝑒 𝑛𝑢𝑚𝑏𝑒𝑟 𝑜𝑟 𝑝 = 0
𝐿4 = 𝑎𝑝 | 𝑝 𝑖𝑠 𝑛𝑜𝑡 𝑎 𝑝𝑟𝑖𝑚𝑒 𝑛𝑢𝑚𝑏𝑒𝑟
Which of the following statement is/are true?
(a) Both 𝐿1 and 𝐿2 are recursive languages but not context-free.
(b) 𝐿3 ∪ 𝐿4 is Context-free language.
(c) 𝐿3 and 𝐿4 are non-regular language but 𝐿3 . 𝐿4 is regular.
(d) 𝐿2 ∗
is regular but 𝐿1 ∗
is CFL.
Q15. Let L be a given context-free language over the alphabet {0, 1}.
Let 𝐿1 = 𝐿 − 𝑥𝑦𝑥 | 𝑥, 𝑦 ∈ 0, 1 ∗
and 𝐿2 = 𝐿. 𝐿. 𝐿1 , then which of the following
statement is/are true?
(a) 𝐿1 − 𝐿2 is regular.
(b) 𝐿1 ∗
and 𝐿2 ∗
are regular.
(c) Every subsets of 𝐿1 ∪ 𝐿2 are regular.
(d) 𝐿2 − 𝐿1 is CFL but not regular.
Q21. [MSQ]
Consider the language L ⊆ {a, b, c}* defined as
L = 𝑎𝑝 𝑏𝑞 𝑐 𝑟 | 𝑝 = 𝑞 𝑜𝑟 𝑞 = 𝑟 𝑜𝑟 𝑟 = 𝑝
Which of the following statement is/are False?
(a) L is DCFL.
(b) The complement of L is CFL.
(c) L is recognised by some PDA.
(d) There exists a non context-free language M such L ∩ 𝑀 = ∅ but L∪ 𝑀 is
regular.
Q22. [MSQ]
Consider the following language
L = {<D>|D is a DFA and L(D) is infinite language}, where <D> denotes the
descrption of the deterministic finite automata (DFA). Then which of the
following statement is/are true about L?
(a) It is regular.
(b) It is Turing decidable.
(c) It is Turing recognizable.
(d) Its complement is Turing recognizable but L is not Turing recognizable.
Q25. [MSQ]
Which of the following regular expressions correctly accepts the set of all 0/1-
strings with an even (possibly zero number of 1’s)?
(a)(10*10*)* (b) (0*10*10*)*
(c) 0*(0*10*10*)*0* (d) (0 + 0*10*1*)*
Q31. Let S be the set of all strings in L ((ab + b)* b(a + ab)*) of length less than or
equal to four. If one string is selected at random from S then what is the
expected length of string? ________
Q32. Let A = {xx | x {a, b}, and h: {a, b}* {a, b}* be a homomorphism with h (a) =
h (b) = a, what is h(A)?
(a) {aa + bb}*
(b) ((a + b)(a + b))*
(c)(aa)*
(d) a*
Q33. Consider four regular expressions over the alphabet {a, b}:
E1 = (ab + a* b* b*)*,
E2 = ((ab)* (a* b*b*)*)*,
E3 = (a + b)*
E4 = a(a + b)*
Which of the following statement is/are False?
(a) L (E2) = L (E3)
(b) L (E3) = L (E4) and L (E1) = L (E4)
(c) The minimal DFA for L (E4) has two states.
(d) The minimal DFA for L (E1) has five states.
Q38. [MSQ]
Consider the following language:
L= 𝑤∈ 𝑎 ∗
∶ 𝑤 𝑚𝑜𝑑 3 ≠ 𝑤 𝑚𝑜𝑑 2
Minimum how many states are required to construct the DFA for L? _________
Q39. The following context-free grammar G generates all strings of the form
ax by for some x and y:
S aT
T aTbb|
What is the relation between x and y?
(a) x = 2(y – 1) (b) x = 2y + 1
(c) y = 2x – 1 (d) y = 2(x – 1)
Q41. [MSQ]
Which of the following statement is/are True?
(a) The set of all base 7 positive integers n such that n % 3 = 2 is regular.
(b) There is a PDA that accepts all valid C programs.
(c) There is a DPDA that accepts the language of all palindromes over the
binary alphabet {0, 1}.
(d) The language consisting of all base 2 numerals for integer powers of 2 is
regular
(c) (d)
Q43. [MSQ]
Consider the following two DFAs:
If the language accepted by DFAs D1 and D2 are L1 and L2, respectively, then
(a) The minimized DFA for (L1∪ L2) has exactly three final states.
(b) The minimized DFA for (L1L2) has exactly two final states.
(c) The minimized DFA for (L1*) has exactly two final states.
(d) None of these
Q47. [MSQ]
Consider an arbitrary language L ⊆ {0, 1}*. Which of the following statements
may not be true?
(a) If L is decidable, then L is infinite.
(b) If L is not decidable, then L is infinite.
(c) If L is the union of two regular languages, then its complement L is
context-free.
(d) If L is context-free, then its complement L is context-free.
For next three questions: Consider non-empty languages (sets) A, B, and C, where
A is Regular, B is Context-Free but not regular, and C is Context Sensitive but not
context-free.
Q49. [MSQ]
Let D = A – B, that is all elements in A but not in B, then D can be
(a) Regular
(b) Context-Sensitive
(c) Context-Free
(d) Non-regular
Q50. [MSQ]
Let E = A B, that is all elements in both A and B, then E can be
(a) Regular
(b) Context-Sensitive
(c) Context-Free
(d) Non-regular
Q51. [MSQ]
Let F = * − C, that is all elements not in C, can be
(a) Regular
(b) Context-Sensitive
(c) Context-Free
(d) Non-regular
In this DFA, which states in the NFA make up the state X, Y and Z
respectively?
(a) X = 2, Y = 4, Z = 3 (b) X = 3, Y = 2, Z = 4
(c) X = 4, Y = 3, Z = 2 (d) X = 2, Y = 3, Z = 4
Q53. [MSQ]
What is the language accepted by the following finite state automata?
Q56. [MSQ]
Which of the following statement is/are False?
(a) {ai|j is prime} is not context free.
(b) {(anb) n |n 1} is context free.
(c) {(anb) m|m, n 1} is context free.
(d) if L1 is context free and L2 is regular, then L1/L2 is context free.
(Note that L1/L2 = {x|y L2, xy L1})
Q57. [MSQ]
Which of the following statement is/are true?
(a) If L is a regular language over the alphabet {0, 1}, then {w1w|w L} is also
regular.
(b) If L is a regular language over the alphabet {0, 1}, then {x1y | x, y L} is
also regular.
(c) If L is a co-finite language over the alphabet {0, 1}, then {w1w|w ∉ L and w
𝐿} is regular language.
(d) The language L = 0* over the alphabet = {0, 1} then {w1w|w L} is also
regular.
Q59. [MSQ]
Which of the following statement is/are true?
(a) The -reach of any state in an NFA contains the state itself.
(b) Every regular expression that does not contain a Kleene star
(or Kleene plus) represents a finite language.
(c) Suppose we define an -DFA to be a DFA that can additionally make -
transitions. Any language that can be recognized by an -DFA can also be
recognized by a DFA that does not make any -transitions.
(d) The context-free grammar S 0S1 | 1S0 | SS | 01 | 10 | 0 | 1 generates
the language (0 +1) +.
Q60. [MSQ]
Consider the following regular language:
L = w | w is a non − empty binary string and w contains even number of 0′s
Which of the following regular expressions can define the language L?
(a) (01*0|1)+
(b) (1*01*01*)+
(c) (1*01*01*)+|1+
(d) ((0|1)* 0(0|1)* 0(0|1)*)+|1+
Q63. [MSQ]
Consider the four regular expressions over the alphabet (a, b}:
E1 = (ab + a*b*b*)*
E2 = ((ab)* (a*b*b*)*)*
E3 = (a + b)*
E4 = a (a + b)*
Which of the following statements are true?
(a) L (E1) = L(E2) = L (E3)
(b) L (E3) = L (E4) and L (E2) = L (E4)
(c) The minimal DFA for L (E2) has five states.
(d) The minimal DFA for L (E3) has one state.
Q65. [MSQ]
Which of the following statement is/are true?
(a) Let A be a set and X = x0, x1, x2 ... be an infinite sequence such that every
element of A appears in X at least once. (Thus, X is an enumeration of A with
possible repetition.) Then, A is countable.
(b) If A is a countable set and B A then B is countable.
(c) If Ai is a countable set for every i N, then UiN Ai is countable. This fact is
sometimes phrased as: The countable union of countable sets is countable.
[Note that the set of finite sequences of natural numbers is countable.]
(d) The set of all languages over the alphabet {0, 1} is uncountable.
Q66. [MSQ]
Which of the following language(s) over {a, b, c} is/are regular?
(a) 𝐿 = 𝑎𝑘 | 𝑘 ≥ 0 and k is product of two 𝑜𝑟 𝑚𝑜𝑟𝑒 𝑝𝑟𝑖𝑚𝑒 𝑛𝑢𝑚𝑏𝑒𝑟 ∪ 𝑎𝑘 | 𝑘
is a prime number
(b) 𝐿 = 𝑎𝑖 𝑏 𝑗 𝑐 𝑘 | 𝑖 + 𝑗 + 𝑘 > 100 & 𝑘 > 50
(c) 𝐿 = 𝑎𝑖 𝑏 𝑗 𝑐 𝑘 | 𝑖 + 𝑗 + 𝑘 > 100 & 𝑗 + 𝑘 > 50
(d) 𝐿 = 𝑎𝑖 𝑏 𝑗 𝑐 𝑘 𝑎𝑚 | 𝑖 + 𝑗 + 𝑘 + 𝑚 ≤ 100 & 𝑗 + 𝑘 ≥ 50
Q68. Which of the following statements is not always true for a recursive set A?
(a) A and 𝐴 are both recursively enumerable.
(b)A is infinite.
(c) A can be printed in increasing order.
(d) All of the above are always true
Q69. [MSQ]
Which of the following statement is/are False?
(a)For a decidable language L, LR may or may not be decidable. (LR denotes the
reverse of language L.
(b) If L {0}* then L is decidable.
(c) If L m {0n 1n I n 0} then L is decidable.
(d) If L is not recursively enumerable then L must be recursively enumerable.
Q70. [MSQ]
The symmetric difference of languages L and M, which we shall denote SD(L,M),
is the set of strings that are in exactly one of L and M. For example, if L = {00,
101} and M = {11, 00}, then SD(L,M) = {11, 101Suppose L = L(0*1*) and M =
L(1*0*). Which of the following regular expression(s) is/are correct regular
expression for SD(L,M)?
(a) (00)*(11)* + (11)*(00)*
(b) 00+11+ + 11+ 00+
(c) 00*11* + 11*00*
(d) 0+1+ + 1+0+
Q73. [MSQ]
Then L1 – R1 may be
(a) Regular (b) CFL but non-regular
(c) Not CFL (d) Recursive
Q74. [MSQ]
Then complement of L1 may be
(a) Regular (b) CFL but non-regular
(c) Not CFL (d) Recursive
Q75. [MSQ]
Then the subset of R2 can be
(a) Regular (b) CFL but non-regular
(c) Not CFL (d) Recursive
Q77. [MSQ]
Which of the following statement is/are true?
(a) The language generated by the following context-free grammar[S 0A1|, A
1S0 | ] is regular.
(b) The language generated by the following context-free grammar:
[S 0A1, A 1S0| ] is CFL but not regular.
(c) The language generated by the following context-free grammar:
[S 0 S 1 |1S0| ] is CFL but not regular.
(d) The language generated by the following context-free grammar:
[S 0S0 |1S1| 0 | 1 | ] is regular.
Q78. [MSQ]
Which of the following language is/are non-regular?
(a) The set of all strings in {0, 1}* such that in every non-empty prefix, the
number of 0s is greater than the number of l s.
(b) {w # x | w, x {0, 1}* and no substring of w is also a substring of x}
(c) {w # x | w, x {0, 1)* & no non-empty substring of w is also a substring of x}
(d) {w # x | w, x {0, 1}* and every non-empty substring of w is also a substring
of x}
Q81. [MSQ]
Consider the following sets of languages over the alphabet {0, 1}:
(i) LDTM is the set of all languages L {0, 1}* such that L is accepted by at least
one deterministic Turing machine.
(ii) LNTM is the set of all languages L {0, 1}* such that L is accepted by at least
one non-deterministic Turing machine.
Which of the following statements is/are true?
(Recall that A ⊆ B means "A is a proper subset of B")
(a) LDTM⊆ LNTM
(b) LDTM⊇ LNTM
(c) LDTM = LNTM
(d) Neither a nor b
Q83. [MSQ]
Which of the following statement is/are true?
(a) a*b*c* - (an bn cn, n 0) is context-free but not regular.
(b) { w {a, b}*: the first, middle, and last characters of w are identical) is
context-free.
(c) {anbn| n 0} {ancn| n 0} is deterministic context-free.
(d) {anbn | n 5} {ambm| m 0} is deterministic context-free.
Q84. [MSQ]
Which of the following statement is/are true?
(a) If middle (L) = {x: y, z * (yxz L)}, then middle ({anbncn, n 0}) = a*b*c*.
(b) Context-free languages are closed under pref (L); where pref (L) = {w: x *
(wx L)}.
(c) Context-free languages are closed under middle (L); whereMiddle (L) = {x: y,
z * (yxz L)}.
(d) If middle (L) = {x: y, z * (yxz L)}, then middle ( 𝑎𝑝 | 𝑝 𝑖𝑠 𝑝𝑟𝑖𝑚𝑒 ) is a*.
How many of the following CFGs (if any) generates the language L (M)?
______________ [Below, only the rules of each CFG are specified.]
i. S aSb|
ii. S aSa|bSb |b
iii. S bSa|
iv. S bSa|ba
v. S bSc|X |Y, X aXb|S, Y cYa|b
vi. S bSa| X, X bXa|ba
vii. S aSb|ab
Q90. [MSQ]
Which of the following statement is/are False?
(a) A context-free grammar for A = {ln 0n | n 0} is G = (V,, R, S), with V = {S} ,
= {0, l} start variable S, and rules R = {S 1SOS | }.
(b) A language that is decided by a nondeterministic Turing machine must also
be recognized by a Deterministic Turing machine
(c) If a language A is recognized by a M = (Q, , , q1, F),
Then A* is recognized by the DFA = M’ (Q,, , q1,Q - F).
(d) If a language A is recognized by a 5-tape Turing machine, then
A U A must be regular.
Q97. [MSQ]
Which of the following statement/s is/are False?
(a) If L1 is regular and L1UL2 is also regular then L2 is always regular.
(b) If L1 is non-regular and L1UL2 is regular then L2 must be non-regular.
(c) If L is regular then tail (L) is also regular, where
tail (L) = {v :uvL for some uΣ*}.
(d) If L is regular then head (L) is also regular, where head (L) = {u :uv L for
some vΣ*}
Q99. The right quotient of a language L1 with respect to L2 is defined as L1/L2 = {x:
yL2, xyL1}
Let L1 = L(a*ba+) and L2 = {aba*} then what will be the L1/L2?
(a)a*
(b)a+
(c)a*b
(d)a+b
Q100. [MSQ]
Which of the following statement/s is/are true?
(a) If L1L2 is not regular and complement of L1 is not regular then L2 is
always non-regular.
(b) Define exchange (a1a2a3…… an) = ana2a3…… an-1a1. If L is regular, so is
exchange (L), where
exchange (L) = {y : y = exchange (w) for some wL }.
(c) Let L1 and L2 are two regular language, then shuffle (L1, L2) is also regular,
where
shuffle (L1, L2) = {w1v1w2v2 ……. wmvm : w1 w2 w3…. wmL1, v1v2v3….. vmL2, for
all wi, vi Σ*}.
(d)None of the above
S → TC | AR,
T → 𝑎𝑇𝑏 | 𝜆,
C→ 𝐶𝐶|𝜆
R → bRc | X | Y
X→Xb | b,
Y→ Yc | c
A → Aa | 𝜆
Which of the language is generated by G?(Assume i, j, k>=0)
(a) L = {aibjck | i = j and j=k} (b) L = {aibjck | i = j or k=j}
(c) L = {aibjck | i = j or j!=k } (d) L = {aibjck | i = j and k!=j}
Q102. [MSQ]
Consider the following grammar G with starting symbol S:
Q105. [MSQ]
Consider the following grammar G with starting symbol S:
𝑺→𝑬 𝑪 𝒂|𝒃
E → AB | BA
A → ZAZ | a
B → ZBZ | b
C → ZCZ | Z
Z→a|b
If the language generated by G is L, then L is the
(a) Complement of 𝑥𝑦 | 𝑥, 𝑦 ∈ 𝑎, 𝑏 ∗
𝑎𝑛𝑑 |𝑥| = |𝑦|
(b) Complement of 𝑥𝑦 | 𝑥, 𝑦 ∈ 𝑎, 𝑏 ∗
𝑎𝑛𝑑 𝑥 = 𝑦 𝑎𝑛𝑑 𝑥 = 𝑦
(c) 𝑥𝑦 | 𝑥, 𝑦 ∈ 𝑎, 𝑏 ∗
𝑠𝑢𝑐 𝑡𝑎𝑡 𝑥 = 𝑦 𝑎𝑛𝑑 𝑥 ≠ 𝑦 ∪ { 𝑥 | 𝑥 ∈ 𝑎, 𝑏 ∗ & 𝑥 𝑖𝑠 𝑜𝑑𝑑}
(d) 𝑥𝑦 | 𝑥, 𝑦 ∈ 0, 1 ∗ 𝑎𝑛𝑑 𝑥 ≠ 𝑦
Q106. [MSQ]
Which of the following language is/are regular?
(a) 𝐿 = an m
| nm is product of two or more prime number
(b) L = 𝑎𝑛 𝑏𝑚 𝑐 𝑘 | 𝑛 + 𝑚 + 𝑘 = 2100 𝑎𝑛𝑑 𝑛, 𝑚, 𝑘 ≥ 0
(c) L = 𝑎𝑛 | 𝑛 ≥ 1 𝑎𝑛𝑑 𝑛𝑢𝑚𝑏𝑒𝑟 𝑜𝑓 𝑑𝑖𝑣𝑖𝑠𝑜𝑟𝑠 𝑜𝑓 𝑛 𝑖𝑠 𝑜𝑑𝑑 ∗
Q109. Consider three language L1, L2, L3 and three grammar G1, G2, G3:
Grammar Language