Question 1 
A  
B  
C  
D 
Discuss it
Question 2 
1. Complement of L(A) is contextfree. 2. L(A) = L((11*0+0)(0 + 1)*0*1*) 3. For the language accepted by A, A is the minimal DFA. 4. A accepts all strings over {0, 1} of length at least 2.
1 and 3 only  
2 and 4 only  
2 and 3 only  
3 and 4 only 
Discuss it
Question 3 
A  
B  
C  
D 
Discuss it
Question 4 
1) abaabaaabaa 2) aaaabaaaa 3) baaaaabaaaab 4) baaaaabaa
1, 2 and 3  
2, 3 and 4  
1, 2 and 4  
1, 3 and 4 
Discuss it
Question 5 
A  
B  
C  
D 
Discuss it
Question 6 
L={ k>0, and n is a positive integer constant}What is the minimum number of states needed in DFA to recognize L?
k+1  
n+1  
2^(n+1)  
2^(k+1) 
Discuss it
Question 7 
A  
B  
C  
D 
Discuss it
Question 8 
n1  
n  
n+1  
2n1 
Discuss it
Question 9 
The set of all strings containing the substring 00.  
The set of all strings containing at most two 0’s.  
The set of all strings containing at least two 0’s.  
The set of all strings that begin and end with either 0 or 1. 
Discuss it
Question 10 
There is unique minimal DFA for every regular language  
Every NFA can be converted to an equivalent PDA.  
Complement of every contextfree language is recursive.  
Every nondeterministic PDA can be converted to an equivalent deterministic PDA. 
Discuss it
Question 11 
Present
State A 
Present
State B 
Input 
Next
State A 
Next
State B 
Output 
0 
0 
0 
0 
0 
1 
0 
1 
0 
1 
0 
0 
1 
0 
0 
0 
1 
0 
1 
1 
0 
1 
0 
0 
0 
0 
1 
0 
1 
0 
0 
1 
1 
0 
0 
1 
1 
0 
1 
0 
1 
1 
1 
1 
1 
0 
0 
1 
3  
4  
5  
6 
Discuss it
Question 12 
Every NFA can be converted to an equivalent DFA  
Every nondeterministic Turing machine can be converted to an equivalent deterministic Turing machine  
Every regular language is also a contextfree language  
Every subset of a recursively enumerable set is recursive 
Discuss it
A language is recursively enumerable if there exists a Turing machine that accepts every string of the language, and does not accept strings that are not in the language. Strings that are not in the language may be rejected or may cause the Turing machine to go into an infinite loop.
A recursive language can't go into an infinite loop, it has to clearly reject the string, but a recursively enumerable language can go into an infinite loop.
So, every recursive language is also recursively enumerable. Thus, the statement ‘Every subset of a recursively enumerable set is recursive’ is false.
Thus, option (D) is the answer.
Please comment below if you find anything wrong in the above post.
Question 13 
A  
B  
C  
D 
Discuss it
Question 14 
1. ϵ + 0(01*1 + 00) * 01* 2. ϵ + 0(10 *1 + 00) * 0 3. ϵ + 0(10 *1 + 10) *1 4. ϵ + 0(10 *1 + 10) *10 *
P  2, Q  1, R  3, S  4  
P  1, Q  3, R  2, S  4  
P  1, Q  2, R  3, S  4  
P  3, Q  2, R  1, S  4 
Discuss it
Figure P: (when loop resolved at middle state)Loop at middle state is either by a 00 or a 01*1. Hence the regular expression: € + 0(00 +01*1)* 01*
Figure Q: (when loop resolved at middle state)Loop at middle state is either by a 00 or a 10*1. Hence the regular expression: € + 0(00 +10*1)* 0.
Figure R: (when loop resolved at middle state)Loop at middle state is either by a 10 or a 10*1. Hence the regular expression: € + 0(10 +10*1)* 1.
Figure S: (when loop resolved at middle state)Loop at middle state is either by a 10 or a 10*1. Hence the regular expression: € + 0(10 +10*1)* 10*. The regular expressions matching with the above gives suitable matching as P1, Q2, R3, S4 This explanation has been contributed by Yashika Arora.
Question 15 
I and IV only  
I and III only  
I only  
IV only 
Discuss it
Question 16 
Every subset of a regular set is regular.  
Every finite subset of a nonregular set is regular.  
The union of two nonregular sets is not regular.  
Infinite union of finite sets is regular. 
Discuss it
 A set is always regular if it is finite.
 A set is always regular if a DFA/NFA can be drawn for it.
Option B: Every finite subset of a nonregular set is regular is True. Each and every set which is finite can have a welldefined DFA for it so whether it is a subset of a regular set or nonregular set it is always regular.
Option C: The union of two nonregular sets is not regular is False. For input alphabets a and b, a^{n} b^{n} for all n≥0 is nonregular as well as a^{n} b^{m} for n≠m is also non regular but their union is a*b* which is regular.
Option D: TInfinite union of finite sets is regular is False. For input alphabets a and b sets {ab}, {aabb}, {aaabbb}…….. are regular but their union {ab} U {aabb} U {aaabbb} U …………………….. gives {a n b n for n>0} which is not regular.
This solution is contributed by Yashika Arora.
Question 17 
15 states  
11 states  
10 states  
9 states 
Discuss it
Question 18 
A  
B  
C  
D 
Discuss it
(C) Strings which are the part of this language are either 0w0 or 1w1 where w is any string in {0, 1}* . Thus, language given in option (C) is regular.
All other languages accept strings which have a palindrome as their substring.
(A) Strings intersect with 0*110* .
(B) Strings intersect with 0*110*1 .
(D) Strings intersect with 10*110* .
According to pumping lemma, languages given option (A), (B) and (D) are irregular.
Thus, option (C) is the answer.
Please comment below if you find anything wrong in the above post.
Question 19 
A  
B  
C  
D 
Discuss it
Thus, the string accepted by the FSA is b* a (a + b)*.
Thus, C is the correct choice.
Please comment below if you find anything wrong in the above post.
Question 20 
1  
2  
3  
4 
Discuss it
Question 21 
A  
B  
C  
D 
Discuss it
Question 22 
{q0, q1, q2}  
{q0, q1}  
{q0, q1, q2, q3}  
{q3} 
Discuss it
Question 23 
I) 0*1(1+00*1)* II) 0*1*1+11*0*1 III) (0+1)*1
I and II only  
I and III only  
II and III only  
I, II, and III 
Discuss it
I) 0*1(1+00*1)* II) 0*1*1+11*0*1 III) (0+1)*1 (I) and (III) represent DFA. (II) doesn't represent as the DFA accepts strings like 11011, but the regular expression doesn't accept.
Question 24 
Only (I)  
Only (II)  
Both (I) and (II)  
Neither (I) nor (II) 
Discuss it
Question 25 
Let L1 = {w ∈ {0,1}^{∗}  w has at least as many occurrences of (110)’s as (011)’s}. Let L2 = { ∈ {0,1}^{∗}  w has at least as many occurrences of (000)’s as (111)’s}.Which one of the following is TRUE?
L1 is regular but not L2  
L2 is regular but not L!  
Both L2 and L1 are regular  
Neither L1 nor L2 are regular 
Discuss it
Question 26 
a*b*(ba)*a*
2  
3  
4  
5 
Discuss it
Question 27 
A  
B  
C  
D 
Discuss it
Question 28 
3  
5  
8  
9 
Discuss it
Question 29 
{w ∈ {a, b}* / every a in w is followed by exactly two b's}  
{w ∈ {a, b}* every a in w is followed by at least two b’}  
{w ∈ {a, b}* w contains the substring 'abb'}  
{w ∈ {a, b}* w does not contain 'aa' as a substring} 
Discuss it
Here w ∈ {a, b}* means w can be any string from the set of {a, b}* and {a, b}* is set of all strings composed of a and b (any string of a and b that you can think of) like null, a, b, aaa, abbaaa, bbbbb, aaaaa, aaaabbbbaabbababab etc.
These type of questions are frequently asked in GATE, where it is asked to choose best fit language among the options. To slove the question like this, there is a better way, we try to eliminate wrong options by choosing testing strings intelligently until we are left with one right option.As given in question, let’s we try to eliminate option (A), it recognizes only those string (composed of a and b) in which every a in w is followed by exactly two b’s , so if we take string abbb(three b’s), then it is accepted by machine , so this options is wrong. Now we try to eliminate option (C), it recognizes only those strings(composed of a and b) in which w contains the substring ‘abb’, so if we take string abbaa (has substring abb), then it is not accepted by machine, so this options is also wrong. Now we try to eliminate option (D), it recognizes only those string(composed of a and b) in which w does not contains ‘aa’ as a substring , so if we take string abbaba(‘aa’ not as a substring), then it is not accepted by machine ,so this options is also wrong. Only option with which we are left, is option (b) in which every a in w is followed by at least two b’ ,is correct.So answer is option (B).
This solution is contributed by Nirmal Bharadwaj.
Question 30 
Df ⊂ Nf and Dp ⊂ Np  
Df ⊂ Nf and Dp = Np  
Df = Nf and Dp = Np  
Df = Nf and Dp ⊂ Np 
Discuss it
Question 31 
It computes 1's complement of the input number  
It computes 2's complement of the input number  
It increments the input number  
It decrements the input number 
Discuss it
The given FSM remains unchanged till first ‘1’ . After that it takes 1’s complement of rest of the input string.
We assume the input string to be ‘110010’ . Thus, according to the FSM, output is ‘001110’ .
2’s complement of ‘110010’ = 1’s complement of ‘110010’ + 1 = 001101 + 1 = 001110 Thus, the FSM computes 2’s complement of the input string.
Hence, option (B) is correct.
Please comment below if you find anything wrong in the above post.
Question 32 
divisible by 3 and 2  
odd and even  
even and odd  
divisible by 2 and 3 
Discuss it
Option (B) is eliminated because string 100 contains odd number of 1s and even number of 0s but is not accepted by the DFA. Option(C) is eliminated because string 011 contains even number of 1s and odd number of 0s but is not accepted by the DFA. Option (D) is eliminated because string 11000 has number of 1s divisible by 2 and number of 0s divisible by 3 but still not accepted by the DFA. Option (A) accepts all strings with number of 1s divisible by 3 and number of 0s divisible by 2.
Extra note: In any case where (no of 1s) MOD N= some integer k and (no of 0s) MOD M= some integer q the number of states in the DFA will be equal to N*M. (The product could be taken for all input alphabets.) E.g.: if we say no. of ones is even and no. of 0s is odd (we check if (no. of 1s) MOD 2=0 and (no. of 0s) MOD 2=0) so no. of states in the DFA=2*2=4. Hence option (B) and (C) can directly be eliminated as the DFA has 6 states and we can look only at the remaining two options.
This solution is contributed by Yashika Arora .
Question 33 
(1*0)*1*  
0 + (0 + 10)*  
(0 + 1)* 10(0 + 1)*  
none of these 
Discuss it
Given regular expression is 0*(10*)* A: (1*0)*1* All strings that can be generated from given regular expression can also be generated from this. B: 0 + (0 + 10)* and C: (0 + 1)* 10(0 + 1)* We can generate 11 from given regular expression which is not possible with B and C C: (0 + 1)* 10(0 + 1)* Not possible as we can produce {epsilon} from the given Regular Expression but not from C
Question 34 
1  
5  
7  
8 
Discuss it
Question 35 
L1 = {0, 1}*  L  
L1 = {0, 1}*  
L1 ⊆ L  
L1 = L 
Discuss it
In case of a Deterministic Finite Automata (DFA) when we change the accepting states into nonaccepting states and nonaccepting states into accepting states, the new DFA obtained accepts the complement of the language accepted by the initial DFA. It is because we have one single movement for a particular input alphabet from one state so the strings accepted by the transformed DFA will be all those which are not accepted by the actual DFA.
But it is not the case with the NFA’s (NonDeterministic Finite Automata). In case of NFA we need to have a check on the language accepted by the NFA. The NFA obtained by changing the accepting states to nonaccepting states and nonaccepting states to accepting states is as follows:
Here we can see that as i. The initial state is an accepting state hence null string is always accepted by the NFA. ii. There is a movement from state 1 to state 2 on both {0, 1} input alphabets and further any number of 1’s and 0’s or even none in the string lets the string be at an accepting state(state 2). Hence the language accepted by the NFA can be any string with any combination of 0’s and 1’s including a null string i.e. {null, 0, 1, 00, 01, 10, 11,……………..} so L1= {0, 1}*.This Explanation has been contributed by Yashika Arora.
Question 36 
Outputs the sum of the present and the previous bits of the input.  
Outputs 01 whenever the input sequence contains 11.  
Outputs 00 whenever the input sequence contains 10.  
None of these 
Discuss it
We assume the input string to be 1101.
1. (A, 1) > (B, 01) Here, previous input bit + present input bit = 0 + 1 = 01 = output
2. (B, 1) > (C, 10) Here, previous input bit + present input bit = 1 + 1 = 10 = output
3. (C, 0) > (A, 01) Here, previous input bit + present input bit = 1 + 0 = 01 = output
4. (A, 1) > (B, 01) Here, previous input bit + present input bit = 0 + 1 = 01 = output
Thus, option (A) is correct.
Please comment below if you find anything wrong in the above post.
Question 37 
2 states  
3 states  
4 states  
5 states 
Discuss it
Question 38 
Only S1 is correct  
Only S2 is correct  
Both S1 and S2 are correct  
None of S1 and S2 is correct 
Discuss it
Question 39 
N^{2}  
2^{N}  
2N  
N! 
Discuss it
Question 40 
8  
14  
15  
48 
Discuss it
We construct a DFA for strings divisible by 6. It requires minimum 6 states as length of string mod 6 = 0, 1, 2, 3, 4, 5
We construct a DFA for strings divisible by 8. It requires minimum 8 states as length of string mod 8 = 0, 1, 2, 3, 4, 5, 6, 7
If first DFA is minimum and second DFA is also minimum then after merging both DFAs resultant DFA will also be minimum. Such DFA is called as compound automata.
So, minimum states in the resultant DFA = 6 * 8 = 48
Thus, option (D) is the answer.
Please comment below if you find anything wrong in the above post.
Question 41 
Only L1 and L2  
Only L2, L3 and L4  
Only L3 and L4  
Only L3 
Discuss it
Question 42 
S ⊂ T  
T ⊂ S  
S = T  
S ∩ T = φ 
Discuss it
Question 43 
L = 0+  
L is regular but not 0+  
L is context free but not regular  
L is not context free 
Discuss it
Question 44 
L must be {a^{n} n is odd}  
L must be {a^{n} n is even}  
L must be {a^{n} ³ O}  
Either L must be {a^{n}  n is odd}, or L must be {a^{n}  n is even} 
Discuss it
Question 45 
It only accepts strings with prefix as "aababb"  
It only accepts strings with substring as "aababb"  
It only accepts strings with suffix as "aababb"  
None of the above 
Discuss it
Question 46 
1  
2  
3  
4 
Discuss it
Question 47 
0  
1  
2  
3 
Discuss it
Question 48 
X_{0} = 1 X_{1} X_{1} = 0 X_{1} + 1 X_{2} X_{2} = 0 X_{1} + {λ}Which one of the following choices precisely represents the strings in X_{0}?
10 (0* + (10)*)1  
10 (0* + (10)*)*1  
1(0* + 10)*1  
10 (0 + 10)*1 + 110 (0 + 10)*1 
Discuss it
The smallest possible string by given grammar is "11". X0 = 1X1 = 11X2 [Replacing X1 with 1X2] = 11 [Replacing X2 with λ] The string "11" is only possible with option (C).
Question 49 
L1: {wxw^{R} ⎪ w, x ∈ {a, b}* and ⎪w⎪, ⎪x⎪ >0} w^{R} is the reverse of string w L2: {a^{n}b^{m} ⎪m ≠ n and m, n≥0 L3: {a^{p}b^{q}c^{r} ⎪ p, q, r ≥ 0}
L1 and L3 only  
L2 only  
L2 and L3 only  
L3 only 
Discuss it
Question 50 
2  
3  
4  
5 
Discuss it
Question 51 
4  
5  
6  
8 
Discuss it
Question 52 
(a* + b* + c*)*  
(a*b*c*)*  
((ab)* + c*)*  
(a*b* + c*)* 
Discuss it
Question 53 
aaa  
aabab  
baaba  
bab 
Discuss it
Question 54 
It is necessarily regular but not necessarily contextfree  
It is necessarily contextfree.  
It is necessarily nonregular.  
None of the above 
Discuss it
Question 55 
It represents a finite set of finite strings.  
It represents an infinite set of finite strings.  
It represents a finite set of infinite strings.  
It represents an infinite set of infinite strings 
Discuss it
Question 56 
regular  
contextfree but not regular.  
contextfree but its complement is not contextfree.  
not contextfree 
Discuss it
The value of ‘n’ is finite. So, only finite number of strings can be part of given language. Therefore, we can construct a finite state automata for this language.
Thus, option (A) is correct.
Please comment below if you find anything wrong in the above post.
Question 57 
L1 = L2  
L1 ⊂ L2
 
L2 ⊂ L1  
None of the above 
Discuss it
Question 58 
L is necessarily a regular language.  
L is necessarily a contextfree language, but not necessarily a regular language  
L is necessarily a nonregular language  
None of the above 
Discuss it
Question 59 
id + id + id + id  
id + (id* (id * id))  
(id* (id * id)) + id  
((id * id + id) * id) 
Discuss it
According to leftmost derivation :
E > E + E (using E > E + E) E > E + E + E (using E > E + E) E > E + E + E + E (using E > E + id) E > id + E + E + E (using E > id) E > id + id + E + E (using E > id) E > id + id + id + E (using E > id) E > id + id + id + id
According to rightmost derivation :
E > E + E (using E > E + E) E > E + E + E (using E > E + E) E > E + E + E + E (using E > E + id) E > E + E + E + id (using E > id) E > E + E + id + id (using E > id) E > E + id + id + E (using E > id) E > id + id + id + id
Thus, option (A) is correct.
Please comment below if you find anything wrong in the above post.
Question 60 
5  
4  
3  
2 
Discuss it
Explanation : In order to produce the yield id + id + id + id , we only required 3 productions of type E → E + E as 3 ‘+’ are required in the final string. This can be done in 5 ways as shown in the picture given below:This explanation has been provided by Pranjul Ahuja.
Question 61 
A  
B  
C  
D 
Discuss it
Question 62 
A  
B  
C  
D 
Discuss it
Question 63 
2  
3  
4  
5 
Discuss it
Question 64 
I. If all states of an NFA are accepting states then the language accepted by the NFA is Σ∗ . II. There exists a regular language A such that for all languages B, A ∩ B is regular.Which one of the following is CORRECT?
Only I is true  
Only II is true  
Both I and II are true  
Both I and II are false 
Discuss it
Question 65 
The automaton accepts u and v but not w  
The automaton accepts each of u, v, and w  
The automaton rejects each of u, v, and w  
The automaton accepts u but rejects v and w 
Discuss it
Question 66 
aaaa  
baba  
abba  
babaaabab 
Discuss it
Question 67 
(a + b)* a(a + b)b  
(abb)*  
(a + b)* a(a + b)* b(a + b)*  
(a + b)* 
Discuss it
Question 68 
L (D) ⊂ L (G)  
L (D) ⊃ L (G)  
L (D) = L (G)  
L (D) is empty 
Discuss it
Question 69 
(0 + 1) * 11(0 + 1) *  
0 * 110 *  
0 * 10 * 10 *  
(0 + 1) * 1(0 + 1) * 1 (0 + 1) * 
Discuss it
Between B and C both contains exactly two 1's but in option B, both 1 will always come together where as in C it is general string.
Question 70 
m ≤ 2^{n}  
n ≤ m  
M has one accept state  
m = 2^{n} 
Discuss it
=> set of states of NFA =n
=> no of subsets of a set with n elements = 2^{n}
=> m<=2^{n}
Question 71 
Set of all strings that do not end with ab  
Set of all strings that begin with either an a or a b  
Set of all strings that do not contain the substring ab,  
The set described by the regular expression b*aa*(ba)*b* 
Discuss it
Question 72 
L_{1} = {a^{i} b^{j} c^{k}  i = j, k ≥ 1}
L_{1} = {a^{i} b^{j}  j = 2i, i ≥ 0}
Which of the following is true?
L_{1} is not a CFL but L_{2} is  
L_{1} ∩ L_{2} = ∅ and L_{1} is nonregular  
L_{1} ∪ L_{2} is not a CFL but L_{2} is  
There is a 4state PDA that accepts L_{1}, but there is no DPDA that accepts L_{2} 
Discuss it
B: L_{1} ∩ L_{2} = ∅ is true
L_{1}is not regular => true
=> B is true
C: L_{1} ∪ L_{2} is not a CFL nut L_{2} is CFL is closed under Union
=> False
D: Both L_{1} and L_{2} accepted by DPDA
Question 73 
L_{2} and L_{3} only  
L_{1} and L_{2} only  
L_{3} only  
L_{2} only 
Discuss it
Question 74 
Which one of the following is TRUE?
L_{1} = L_{2}  
L_{1} ⊂ L_{2}  
L_{1} ∩ L_{2}' = ∅  
L_{1} ∪ L_{2} ≠ L_{1} 
Discuss it
Question 75 
For a grammar to be LR(1) it is sufficient that a lefttoright shift reduce parser be able to recognize handles of rightsentential form when they appear on the stack.
 
For a grammar to be LR(1) it is sufficient that a lefttoright shift reduce parser be able to recognize handles of leftsentential form when they appear on the stack.  
For a grammar to be LR(1) it is sufficient that a lefttoright shift reduce parser be able to recognize handles of leftsentential form or rightsentential form when they appear on the stack.  
All of the above

Discuss it
LR(1) – Deriving a rightmost derivation for the string.
LR(1) – one token lookahead
In the first choice we read from Left to right deriving the rightmost sentential form and looking one symbol ahead which is stack top. So option (a) is correct.
Question 76 
r1 = 1(0 + 1)* r2 = 1(1 + 0)+ r3 = 11*0What is the relation between the languages generated by the regular expressions above ?
L (r1) ⊆ L (r2) and L(r1) ⊆ L(r3)  
L (r1) ⊇ L (r2) and L(r2) ⊇ L(r3)  
L (r1) ⊇ L (r2) and L(r2) ⊆ L(r3)  
L (r1) ⊇ L (r3) and L(r2) ⊆ L(r1)

Discuss it
Question 77 
NFA – 3, DFA – 4  
NFA – 3, DFA – 3
 
NFA – 3, DFA – 3  
NFA – 4, DFA – 4

Discuss it
Question 78 
E > TE’ E’ > +TE’  ԑ T’ > FT’ T’ > *FT’  ԑ F > (E)  idIf LL(1) parsing table is constructed using the grammar G, then how many entries are present in the row that represents E’ nonterminal ? (consider the entries which are not error/not blank entries)
1  
2  
3  
4 
Discuss it
Question 79 
Let L = {w  w has equal number of 0’s and 1’s}
init (L) will contain:
all binary strings with unequal number of 0’s and 1’s
 
all binary strings with ԑstring  
all binary strings with exactly one more 0's than number of 1's
 
None of above

Discuss it
Question 80 
On every input on which M1 doesn’t halt, M2 doesn’t halt too.
 
On every i/p on which M1 halts, M2 halts too.
 
On every i/p which M1 accepts, M2 halts.
 
None of above.

Discuss it