Question 1
Consider the languages L1 = and L2 = {a}. Which one of the following represents L1 L2* U L1*
 A A B B C C D D
GATE CS 2013    Regular languages and finite automata
Discuss it

Question 1 Explanation:
L1 L2* U L1* Result of L1 L2* is [Tex]\phi[/Tex]. {[Tex]\phi[/Tex]} indicates an empty language. Concatenation of [Tex]\phi[/Tex] with any other language is [Tex]\phi[/Tex]. It works as 0 in multiplication. L1* = [Tex]\phi[/Tex]* which is {[Tex]\epsilon[/Tex]}. Union of [Tex]\phi[/Tex] and {[Tex]\epsilon[/Tex]} is {[Tex]\epsilon[/Tex]}
 Question 2
Consider the DFA given. Which of the following are FALSE?
1. Complement of L(A) is context-free.
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. 
 A 1 and 3 only B 2 and 4 only C 2 and 3 only D 3 and 4 only
GATE CS 2013    Regular languages and finite automata
Discuss it

Question 2 Explanation:
1 is true. L(A) is regular, its complement would also be regular. A regular language is also context free. 2 is true. 3 is false, the DFA can be minimized to two states. Where the second state is final state and we reach second state after a 0. 4 is clearly false as the DFA accepts a single 0.
 Question 3
W hat is the complement of the language accepted by the NFA shown below?
 A A B B C C D D
GATE CS 2012    Regular languages and finite automata
Discuss it

Question 3 Explanation:
The given alphabet contains only one symbol {a} and the given NFA accepts all strings with any number of occurrences of ‘a’. In other words, the NFA accepts a+. Therefore complement of the language accepted by automata is empty string.
 Question 4
Given the language L = {ab, aa, baa}, which of the following strings are in L*?
1) abaabaaabaa
2) aaaabaaaa
3) baaaaabaaaab
4) baaaaabaa 
 A 1, 2 and 3 B 2, 3 and 4 C 1, 2 and 4 D 1, 3 and 4
GATE CS 2012    Regular languages and finite automata
Discuss it

Question 4 Explanation:
 Question 5
Consider the set of strings on {0,1} in which, every substring of 3 symbols has at most two zeros. For example, 001110 and 011001 are in the language, but 100010 is not. All strings of length less than 3 are also in the language. A partially completed DFA that accepts this language is shown below. The missing arcs in the DFA are
 A A B B C C D D
GATE CS 2012    Regular languages and finite automata
Discuss it

Question 5 Explanation:
 Question 6
Definition of a language L with alphabet {a} is given as following.
             L={| k>0, and n is a positive integer constant}
What is the minimum number of states needed in DFA to recognize L?
 A k+1 B n+1 C 2^(n+1) D 2^(k+1)
GATE CS 2011    Regular languages and finite automata
Discuss it

Question 6 Explanation:
 Question 7
A deterministic finite automation (DFA)D with alphabet {a,b} is given below Which of the following finite state machines is a valid minimal DFA which accepts the same language as D?
 A A B B C C D D
GATE CS 2011    Regular languages and finite automata
Discuss it

Question 7 Explanation:
Options (B) and (C) are invalid because they both accept ‘b’ as a string which is not accepted by give DFA. (D) is invalid because it accepts "bba" which are not accepted by given DFA.
 Question 8
Let w be any string of length n is {0,1}*. Let L be the set of all substrings of w. What is the minimum number of states in a non-deterministic finite automaton that accepts L?
 A n-1 B n C n+1 D 2n-1
GATE CS 2010    Regular languages and finite automata
Discuss it

Question 8 Explanation:
We need minimum n+1 states to build NFA that accepts all substrings of a binary string. For example, following NFA accepts all substrings of “010″ and it has 4 states.
 Question 9
Which one of the following languages over the alphabet {0,1} is described by the regular expression: (0+1)*0(0+1)*0(0+1)*?
 A The set of all strings containing the substring 00. B The set of all strings containing at most two 0’s. C The set of all strings containing at least two 0’s. D The set of all strings that begin and end with either 0 or 1.
GATE-CS-2009    Regular languages and finite automata
Discuss it

Question 9 Explanation:
The regular expression has two 0′s surrounded by (0+1)* which means accepted strings must have at least 2 0′s.
 Question 10
Which one of the following is FALSE?
 A There is unique minimal DFA for every regular language B Every NFA can be converted to an equivalent PDA. C Complement of every context-free language is recursive. D Every nondeterministic PDA can be converted to an equivalent deterministic PDA.
GATE-CS-2009    Regular languages and finite automata
Discuss it

Question 10 Explanation:
Deterministic PDA cannot handle languages or grammars with ambiguity, but NDPDA can handle languages with ambiguity and any context-free grammar. So every nondeterministic PDA can not be converted to an equivalent deterministic PDA.
 Question 11
Given the following state table of an FSM with two states A and B, one input and one output:
 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
If the initial state is A=0, B=0, what is the minimum length of an input string which will take the machine to the state A=0, B=1 with Output = 1?
 A 3 B 4 C 5 D 6
GATE-CS-2009    Regular languages and finite automata
Discuss it

Question 11 Explanation:
//(0, 0) --1--> (0, 1) --0-->(1, 0) --1--> (0, 1) and output 1 According to the question we have to reach the states A=0, B=1 and output=1. This state is shown by green color. Thus to reach final states as A=0, B=1 and output=1 we have to reach previous states of A=1, B=0. Since initial states are A=0,B=0 (red); we provide input=1 (to reach A=0,B=1) Now this will give present states as A=0, B=1 and output=0. Now we provide (blue) input=0 (to reach A=1,B=0) with present states as A=0, B=1. The present states will become A=1, B=0 and output=0. This is what is required. On providing input=1 we get final states as A=0, B=1 and output=1. Hence an input string of 3 i.e. 101 leads to the desired output and states. This solution is contributed by Kriti Kushwaha
 Question 12
Which of the following statements is false?
 A Every NFA can be converted to an equivalent DFA B Every non-deterministic Turing machine can be converted to an equivalent deterministic Turing machine C Every regular language is also a context-free language D Every subset of a recursively enumerable set is recursive
Regular languages and finite automata    GATE CS 2008
Discuss it

Question 12 Explanation:

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
Given below are two finite state automata (→ indicates the start state and F indicates a final state)Which of the following represents the product automaton Z×Y?
 A A B B C C D D
Regular languages and finite automata    GATE CS 2008
Discuss it

Question 13 Explanation:
Solution for the problem is :

Thus, option (A) is correct.

Please comment below if you find anything wrong in the above post.
 Question 14
Match the following NFAs with the regular expressions they correspond to
 1. ϵ + 0(01*1 + 00) * 01*
2. ϵ + 0(10 *1 + 00) * 0
3. ϵ + 0(10 *1 + 10) *1
4. ϵ + 0(10 *1 + 10) *10 *
 A P - 2, Q - 1, R - 3, S - 4 B P - 1, Q - 3, R - 2, S - 4 C P - 1, Q - 2, R - 3, S - 4 D P - 3, Q - 2, R - 1, S - 4
Regular languages and finite automata    GATE CS 2008
Discuss it

Question 14 Explanation:
Trick: Here we see in all the given figures then second state has a loop over the input alphabets. In such cases we should resolve the loop at that state and transform the NFA into a simpler one to get a regular expression for the NFA. For resolving the loop, first reach the state where loop is to be resolved then draw all loops over that state and all possible movements to move to the final state.
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 P-1, Q-2, R-3, S-4 This explanation has been contributed by Yashika Arora.
 Question 15
Which of the following are regular sets?
 A I and IV only B I and III only C I only D IV only
Regular languages and finite automata    GATE CS 2008
Discuss it

Question 15 Explanation:
1.L = {a n b 2m |m, n ≥ 0} is a regular language of the form a ∗ (bb) ∗ . 2. L = {a n b m |n = 2m} is not a regular language. This is a similar language as of {a n b n } which is known to be not a regular language. 3. L = {a n b m |n notEqualTo m} is not regular because there is no way to for finite automaton to remember n, number of as. 4. L = {xcy|x, y ∈ {a, b} ∗ } is a regular language which is concatenation of {x|x ∈ a, b ∗ } on itself with a alphabet c in between. Note: Regular languages are closed under concatenation. Hence, correct answer would be (A) I and IV only.   This solution is contributed by vineet purswani.
 Question 16
Which of the following is TRUE?
 A Every subset of a regular set is regular. B Every finite subset of a non-regular set is regular. C The union of two non-regular sets is not regular. D Infinite union of finite sets is regular.
Regular languages and finite automata    GATE-CS-2007
Discuss it

Question 16 Explanation:
Some points for Regular Sets:
• A set is always regular if it is finite.
• A set is always regular if a DFA/NFA can be drawn for it.
Option A: Every subset of a regular set is regular is False. For input alphabets a and b, a*b* is regular. A DFA can be drawn for a*b* but a n b n for n≥0 which is a subset of a*b* is not regular as we cannot define a DFA for it.
Option B: Every finite subset of a non-regular set is regular is True. Each and every set which is finite can have a well-defined DFA for it so whether it is a subset of a regular set or non-regular set it is always regular.
Option C: The union of two non-regular sets is not regular is False. For input alphabets a and b, an bn for all n≥0 is non-regular as well as an bm 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
A minimum state deterministic finite automaton accepting the language L={w | w ε {0,1} *, number of 0s and 1s in w are divisible by 3 and 5, respectively} has
 A 15 states B 11 states C 10 states D 9 states
Regular languages and finite automata    GATE-CS-2007
Discuss it

Question 17 Explanation:
Here a string w of 0's and 1's should have the property that, the no of 0's in the string w should be divisible by 3 ( N(0) % 3 =0 ), and the number of 1's the string w should be divisible by 5 (N(1) % 5 =0). Having said that, the Language will contain the strings such as : { ε , 000, 11111, 00011111, 00111101 , 11111000, 10101011 , 00000011111,....and so on } So, strings accepted by the automaton have to be of length 0, 3, 5, 8, 11, 13, 14, 16....and so on, i.e. equation for length will be 3x + 5y (where x,y>=0 ) Modulo 3 gives remainder as ( 0, 1, 2 ) , and Modulo 5 gives remainder as ( 0, 1, 2, 3, 4 ).  Hence 3 * 5 sates, i.e. there will be 15 states in the automaton to represent this. Please comment below if you find anything wrong in the above post.
 Question 18
Which of the following languages is regular?
 A A B B C C D D
Regular languages and finite automata    GATE-CS-2007
Discuss it

Question 18 Explanation:

(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
Consider the following Finite State Automaton. The language accepted by this automaton is given by the regular expression
 A A B B C C D D
Regular languages and finite automata    GATE-CS-2007
Discuss it

Question 19 Explanation:
In this case, we would at least have to reach q1 so that our string gets accepted. So, b* a is the smallest accepted string. Now, at q1, any string with any number of a's and b's would be accepted. So, we append (a + b)* to the smallest accepted string.

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
Consider the automata given in previous question. The minimum state automaton equivalent to the above FSA has the following number of states
 A 1 B 2 C 3 D 4
Regular languages and finite automata    GATE-CS-2007
Discuss it

Question 20 Explanation:
Following is equivalent FSA with 2 states.
 Question 21
Which one of the following is TRUE?
 A A B B C C D D
Regular languages and finite automata    GATE-CS-2014-(Set-1)
Discuss it

Question 21 Explanation:
(A) L = {a n b n |n >= 0} is not regular because there does not exists a finite automaton that can derive this grammar. Intuitively, finite automaton has finite memory, hence it can’t track number of as. It is a standard CFL though. (B) L = {a n b n |n is prime} is again not regular because there is no way to remember/check if current n is prime or not. Hence, no finite automaton exists to derive this grammar, thus it is not regular. (C) L = {w|w has 3k+1 bs} is a regular language because k is a fixed constant and we can easily emulate L as a ∗ ba ∗ .....ba ∗ such that there are exactly 3k + 1 bs and a ∗ s surrounding each b in the grammar. (D) L = {ww| w ∈ Σ ∗ } is again not a regular grammar, infact it is not even a CFG. There is no way to remember and derive double word using finite automaton. Hence, correct answer would be (C). This solution is contributed by vineet purswani.
 Question 22
 A {q0, q1, q2} B {q0, q1} C {q0, q1, q2, q3} D {q3}
Regular languages and finite automata    GATE-CS-2014-(Set-1)
Discuss it

 Question 23
Which of the regular expressions given below represent the following DFA?
I) 0*1(1+00*1)*
II) 0*1*1+11*0*1
III) (0+1)*1 
 A I and II only B I and III only C II and III only D I, II, and III
Regular languages and finite automata    GATE-CS-2014-(Set-1)
Discuss it

Question 23 Explanation:
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
Which one of the following is CORRECT?
 A Only (I) B Only (II) C Both (I) and (II) D Neither (I) nor (II)
Regular languages and finite automata    GATE-CS-2014-(Set-2)
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?
 A L1 is regular but not L2 B L2 is regular but not L! C Both L2 and L1 are regular D Neither L1 nor L2 are regular
Regular languages and finite automata    GATE-CS-2014-(Set-2)
Discuss it

Question 25 Explanation:
L1 is regular let us consider the string 011011011011 In this string, number of occurrences of 011 are 4 but when we see here 110 is also occurred and the number of occurrence of 110 is 3. Note that if i add a 0 at the last of string we can have same number of occurrences of 011 and 110 so this string is accepted. We can say if the string is ending with 011 so by appending a 0 we can make 110 also. Now string2: 110110110110 in this number of occurrences of 110 is 4 and 011 is 3 which already satisfy the condition So we can observe here that whenever 110 will be there string will be accepted So with this idea we can build an automata for this. Therefore, it is regular.
 Question 26
The length of the shortest string NOT in the language (over Σ = {a, b}) of the following regular expression is ______________.
a*b*(ba)*a*
 A 2 B 3 C 4 D 5
Regular languages and finite automata    GATE-CS-2014-(Set-3)
Discuss it

Question 26 Explanation:
The string "bab" is the shortest string not acceptable by regular expression.
 Question 27
If s is a string over (0 + 1)* then let n0(s) denote the number of 0’s in s and n1(s) the number of 1’s in s. Which one of the following languages is not regular? 7" />
 A A B B C C D D
Regular languages and finite automata    GATE-CS-2006
Discuss it

Question 27 Explanation:
Languages in option (A) And (D) are finite so both the options are eliminated. For option A: There are finite no. of 3 digit prime numbers. There exists a FA for every finite set. Hence FA is possible. For option D: Possible remainders for 7 is 0 to 6, and for 5 its 0 to 4. Using 35 states, FA can be made. For option B: We can have 6 states (including 1 reject state) state 1: difference is 0 state 2: difference is 1 (more 1s) state 3: difference is 1 (more 0s) state 4: difference is 2 (more 1s) state 5: difference is 2 (more 0s) state 6: reject state for difference >= 3 Suppose the string is 000101 Scan 0 -> state 3 Scan 0 -> state 5 Scan 0 -> reject (since diff. is 3 now) Similarly if we try for string: 010100, this will be accepted.
 Question 28
Consider the regular language L = (111 + 11111)*. The minimum number of states in any DFA accepting this languages is:
 A 3 B 5 C 8 D 9
Regular languages and finite automata    GATE-CS-2006
Discuss it

Question 28 Explanation:
The finite state automata is :

Thus, option (D) is correct.

Please comment below if you find anything wrong in the above post.
 Question 29
Consider the machine M: The language recognized by M is :
 A {w ∈ {a, b}* / every a in w is followed by ex­actly two b's} B {w ∈ {a, b}* every a in w is followed by at least two b’} C {w ∈ {a, b}* w contains the substring 'abb'} D {w ∈ {a, b}* w does not contain 'aa' as a substring}
Regular languages and finite automata    GATE-CS-2005
Discuss it

Question 29 Explanation:

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
Let Nf and Np denote the classes of languages accepted by non-deterministic finite automata and non-deterministic push-down automata, respectively. Let Df and Dp denote the classes of languages accepted by deterministic finite automata and deterministic push-down automata, respectively. Which one of the following is TRUE?
 A Df ⊂ Nf and Dp ⊂ Np B Df ⊂ Nf and Dp = Np C Df = Nf and Dp = Np D Df = Nf and Dp ⊂ Np
Regular languages and finite automata    GATE-CS-2005
Discuss it

Question 30 Explanation:
Deterministic pushdown automata can recognize all deterministic context-free languages while nondeterministic ones can recognize all context-free languages. Mainly the former are used in parser design (Source: http://en.wikipedia.org/wiki/Pushdown_automaton ). Deterministic context-free languages (DCFL) are a proper subset of context-free languages. Non-deterministic finite automata and Deterministic finite automata, both accept same set of languages as NFAs can be translated to equivalent DFAs using the subset construction algorithm.
 Question 31
The following diagram represents a finite state machine which takes as input a binary number from the least significant bit. Which one of the following is TRUE?
 A It computes 1's complement of the input number B It computes 2's complement of the input number C It increments the input number D It decrements the input number
Regular languages and finite automata    GATE-CS-2005
Discuss it

Question 31 Explanation:
The given finite state machine takes a binary number from LSB as input.
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
The following finite state machine accepts all those binary strings in which the number of 1's and 0's are respectively.
 A divisible by 3 and 2 B odd and even C even and odd D divisible by 2 and 3
Regular languages and finite automata    GATE-CS-2004
Discuss it

Question 32 Explanation:

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
The regular expression 0*(10*)* denotes the same set as
 A (1*0)*1* B 0 + (0 + 10)* C (0 + 1)* 10(0 + 1)* D none of these
Regular languages and finite automata    GATE-CS-2003
Discuss it

Question 33 Explanation:
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
Consider the following deterministic finite state automaton M. Let S denote the set of seven bit binary strings in which the first, the fourth, and the last bits are 1. The number of strings in S that are accepted by M is
 A 1 B 5 C 7 D 8
Regular languages and finite automata    GATE-CS-2003
Discuss it

Question 34 Explanation:
Given a language of 7 bit strings where 1st, 4th and 7th bits are 1. The following are 7 strings of language that can be accepted by DFA. 1001001 1001011 1001101 1001111 1101001 1111001 1011001
 Question 35
Consider the NFA M shown below. Let the language accepted by M be L. Let L1 be the language accepted by the NFA M1, obtained by changing the accepting state of M to a non-accepting state and by changing the non-accepting state of M to accepting states. Which of the following statements is true ?
 A L1 = {0, 1}* - L B L1 = {0, 1}* C L1 ⊆ L D L1 = L
Regular languages and finite automata    GATE-CS-2003
Discuss it

Question 35 Explanation:
In case of a Deterministic Finite Automata (DFA) when we change
the accepting states into non-accepting states and non-accepting
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 (Non-Deterministic 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 non-accepting states and
non-accepting 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
The Finite state machine described by the following state diagram with A as starting state, where an arc label is x / y and x stands for 1-bit input and y stands for 2- bit output
 A Outputs the sum of the present and the previous bits of the input. B Outputs 01 whenever the input sequence contains 11. C Outputs 00 whenever the input sequence contains 10. D None of these
Regular languages and finite automata    GATE-CS-2002
Discuss it

Question 36 Explanation:

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
The smallest finite automation which accepts the language {x | length of x is divisible by 3} has :
 A 2 states B 3 states C 4 states D 5 states
Regular languages and finite automata    GATE-CS-2002
Discuss it

Question 37 Explanation:

Thus, we require 3 states.

So, B is the correct choice.

Please comment below if you find anything wrong in the above post.
 Question 38
Consider the following two statements:
 A Only S1 is correct B Only S2 is correct C Both S1 and S2 are correct D None of S1 and S2 is correct
Regular languages and finite automata    GATE-CS-2001
Discuss it

Question 38 Explanation:
We can easily build a DFA for S1. All we need to check is whether input string has even number of 0's. Therefore S1 is regular. We can't make a DFA for S2. For S2, we need a stack. Therefore S2 is not regular.
 Question 39
Given an arbitary non-deterministic finite automaton (NFA) with N states, the maximum number of states in an equivalent minimized DFA is at least
 A N2 B 2N C 2N D N!
Regular languages and finite automata    GATE-CS-2001
Discuss it

Question 39 Explanation:
 Question 40
Consider a DFA over ∑ = {a, b} accepting all strings which have number of a’s divisible by 6 and number of b’s divisible by 8. What is the minimum number of states that the DFA will have?
 A 8 B 14 C 15 D 48
Regular languages and finite automata    GATE-CS-2001
Discuss it

Question 40 Explanation:

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
Consider the following languages Which of the languages are regular?
 A Only L1 and L2 B Only L2, L3 and L4 C Only L3 and L4 D Only L3
Regular languages and finite automata    GATE-CS-2001
Discuss it

Question 41 Explanation:
A language is known as regular language if there exists a finite automaton (no matter whether it is deterministic or non-deterministic) which recognizes it. So if for a given language, we can come up with an finite automaton, we can say that the language is regular. But sometimes, it is not quite obvious to design an automaton corresponding to a given language but it surely exists. In that case, we should not start thinking that the given language is not regular. We should use pumping lemma to decide whether the given language is regular or not. According to pumping lemma, “Suppose L is a regular language, then there exists a l ≥ 1 such that for all string s ∈ L, where |s| ≥ l, we can always split s (there exists at least one such splitting) in such a way that s can be written as xyz with |xy| ≤ l and y ≠ ε  and for all i ≥ 0 , xyiz ∈ L”. l is known as pumping length. Let’s rephrase the given Lemma for non regular languages. Suppose L is a language, if for all l ≥ 1 there exist a string s ∈ L with |s| ≥ l such that for all splitting (there doesn’t exists a single splitting which doesn’t follow this rule) of s in form of xyz such that |xy| ≥ l and y ≠ ε , there exists an i≥ 0 such that xyiz ∉ L, then L is not regular. Notice that here we stress on finding such s if we want to prove that a language is not regular. Choice of the Questions: (a) In choice 1, Lets first consider w being of length n and containing only a. In this case the language represents anan. The length of the string represented by language should be Even. Consider l = n, then xyz = anan with xy = an. lets assume y = a, then consider the membership of xyiz with i = 0. This will simply be of odd length which doesn’t belongs to L. So L is not regular. To discuss it in more detail, let’s consider another example. Suppose w = apb, then string formed by L will be apbapb which is of length 2p + 2. Assume l = p, then xy = ap. suppose y = a, then consider the membership of xyiz with i = 0. This certainly doesn’t belongs to L. So L is not regular. (b) In choice 2, The first example will work as above. In the second example, the string will be apbbap, and there will be no changes in process for proving it to be non regular. (c) In choice 3, Assuming that we are considering integer from 0 and 02∗n results in empty string, Which is also accepted, We can simply construct a DFA as given below. It simply accepts a string if it is either empty or contain even number of zeros. So the language is regular. (d) In choice 4, We can simply assume that the pumping length l =i2/2. Now consider the xy = 0l with y = 0, Now if we check the membership of xy2z, we can find that this will represent 0i^2+1, and corresponding to which there exists no j such that j2 = i2 + 1 where i and j are integer except j = 1 and i = 0. But since i can’t be zero. In Short, using pumping lemma, we can generate 0i^2+1 as well as 0i^2-1, which won’t be available in L. So L is not regular. This explanation has been contributed by Durgesh Pandey.
 Question 42
Let S and T be language over Σ = {a,b} represented by the regular expressions (a+b*)* and (a+b)*, respectively. Which of the following is true?
 A S ⊂ T B T ⊂ S C S = T D S ∩ T = φ
Regular languages and finite automata    GATE-CS-2000
Discuss it

Question 42 Explanation:
Both have same output because if we draw DFA of S which is (a+b*)*, at final state it is just repeating.
 Question 43
Let L denotes the language generated by the grammar S -> 0S0/00. Which of the following is true?
 A L = 0+ B L is regular but not 0+ C L is context free but not regular D L is not context free
Regular languages and finite automata    GATE-CS-2000
Discuss it

Question 43 Explanation:
Option A : L is not 0+ , because 0+ will contain any arbitrary string over alphabet 0 with any no of 0's ( except empty string ), for ex: {0, 00, 000,00000}, but L will only have the strings as { 00, 0000, 000000,...}, i.e only even no of  0's ( excluding empty string}.   Option D : L is a Context Free Language, because the Grammar G which generates the language L is Context Free Grammar. A Grammar G is CFG if all of its productions are of the form A->α, where A is a single non-terminal and α belongs to (V∪ T)* , i.e  α can be a string of terminals and/or Non-terminals. (V represents a non-terminal and T represents a terminal)   Option C : L is a Regular Language, Because we are able to write a regular expression for it ( and also able to make a Finite Automaton), which is (00)+.     Option B :  Hence This option is Correct, because L is Regular but not 0+, as we proved above.
 Question 44
What can be said about a regular language L over {a} whose minimal finite state automaton has two states?
 A L must be {an| n is odd} B L must be {an| n is even} C L must be {an| ³ O} D Either L must be {an | n is odd}, or L must be {an | n is even}
Regular languages and finite automata    GATE-CS-2000
Discuss it

Question 44 Explanation:
There are two states. When first state is final, it accepts even no. of a's. When second state is final, it accepts odd no. of a's.
 Question 45
Consider the following Deterministic Finite Automata Which of the following is true?
 A It only accepts strings with prefix as "aababb" B It only accepts strings with substring as "aababb" C It only accepts strings with suffix as "aababb" D None of the above
Regular languages and finite automata    GATE-CS-2015 (Mock Test)
Discuss it

Question 45 Explanation:
To reach the accepting state, any string will have to go through edges having aababb as labels in order. Though it might not be a continuous substring, but it sure will be a substring. There might be some cases where same substring always exists as a prefix or suffix for some DFA, but in this situation we don’t have to consider those cases, given this question has single choice answer.> O − a− > O − a− > O − b− > O − a− > O − b− > O − b− > O Hence, correct answer should be (B). This solution is contributed by vineet purswani.
 Question 46
How many minimum states are required in a DFA to find whether a given binary string has odd number of 0's or not, there can be any number of 1's.
 A 1 B 2 C 3 D 4
Regular languages and finite automata    GATE-CS-2015 (Mock Test)
Discuss it

Question 46 Explanation:
 Question 47
Consider the DFAs M and N given above. The number of states in a minimal DFA that accepts the language L(M) ∩ L(N) is __________.
 A 0 B 1 C 2 D 3
Regular languages and finite automata    GATE-CS-2015 (Set 1)
Discuss it

Question 47 Explanation:
In DFA M: all strings must end with 'a'. In DFA N: all strings must end with 'b'. So the intersection is empty. For an empty language, only one state is required in DFA. The state is non-accepting and remains on itself for all characters of alphabet.
 Question 48
Consider alphabet ∑ = {0, 1}, the null/empty string λ and the sets of strings X0, X1 and X2 generated by the corresponding non-terminals of a regular grammar. X0, X1 and X2 are related as follows:
X0 = 1 X1
X1 = 0 X1 + 1 X2
X2 = 0 X1 + {λ} 
Which one of the following choices precisely represents the strings in X0?
 A 10 (0* + (10)*)1 B 10 (0* + (10)*)*1 C 1(0* + 10)*1 D 10 (0 + 10)*1 + 110 (0 + 10)*1
Regular languages and finite automata    GATE-CS-2015 (Set 2)
Discuss it

Question 48 Explanation:
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
Which of the following languages is/are regular?
L1: {wxwR ⎪ w, x ∈ {a, b}* and ⎪w⎪, ⎪x⎪ >0} wR is the reverse of string w
L2: {anbm ⎪m ≠ n and m, n≥0
L3: {apbqcr ⎪ p, q, r ≥ 0}  
 A L1 and L3 only B L2 only C L2 and L3 only D L3 only
Regular languages and finite automata    GATE-CS-2015 (Set 2)
Discuss it

Question 49 Explanation:
L3 is simple to guess, it is regular.
Below is DFA for L1.

L1 is interesting. The important thing to note
about L1 is length of x is greater than 0, i.e.,
|x| > 0.
So any string than starts and ends with same character
is acceptable by language and remaining string becomes w.
Below is DFA for L1.


 Question 50
The number of states in the minimal deterministic finite automaton corresponding to the regular expression (0 + 1)*(10) is ____________
 A 2 B 3 C 4 D 5
Regular languages and finite automata    GATE-CS-2015 (Set 2)
Discuss it

Question 50 Explanation:
Below is NFA for the given regular expression (0 + 1)*(10) Below is DFA for the same.
 Question 51
Let T be the language represented by the regular expression Σ∗0011Σ∗ where Σ = {0, 1}. What is the minimum number of states in a DFA that recognizes L' (complement of L)?
 A 4 B 5 C 6 D 8
Regular languages and finite automata    GATE-CS-2015 (Set 3)
Discuss it

Question 51 Explanation:
The given regular expression matches with all strings that contain 0011. The complement should match with all strings except the strings with 0011 as substring. Following are some interesting facts/observations from this question. 1) Complement of a regular language is also regular. 2) Since complement is regular, it is always possible to make a DFA for complement. 3) A DFA that accepts its complement is obtained from the above DFA by changing all non-accepting states to accepting states and vice versa as done in this question. Below is DFA for the complement. We can get below DFA by first drawing DFA of regular language for strings with substring as 0011. After drawing DFA, we can invert all states (single circle to double circle and vice versa) Reference : http://www.cs.odu.edu/~toida/nerzic/390teched/regular/fa/complement.html
 Question 52
Which one of the following regular expressions is NOT equivalent to the regular expression (a + b + c) *?
 A (a* + b* + c*)* B (a*b*c*)* C ((ab)* + c*)* D (a*b* + c*)*
Regular languages and finite automata    GATE-IT-2004
Discuss it

Question 52 Explanation:
C- (ab)* + c*)* will always give strings with "ab" together.Whereas (a+b+c)* would generate language where a,b,c may not be always together. A,B,D may generate same language as (a+b+c)*   So, Answer is (C)
 Question 53
Which one of the following strings is not a member of L (M)?
 A aaa B aabab C baaba D bab
Regular languages and finite automata    GATE-IT-2004
Discuss it

Question 53 Explanation:
Basics of PDA A push down automata or a PDA is essentially a NFA with a stack and its transition function also depends on the symbol at the stack top. Formally, a PDA is a 6-tuple (Q, Σ, Γ, δ, q0, F) with Q being set of all possible states, Σ is the set of all possible input, Γ is the set of all possible stack symbol, δ : Q × Σ × Γ → Q × Γ is the transition function, q0 is the initial state, and F ⊆ Q is the set of final state. Some times, PDA is also known to be of 7 tuples when we considers the initial stack symbol z0 as an additional member in the above 6 tuples. Note that there should exists a transition function for a given input otherwise there won’t be any possible move. The PDA can be of two types: Empty stack accepting PDA and Final state PDA. Empty stack accepting PDAs are the PDAs for which a given input is accepted if on a given input string, when the input exhausts, the stack should be empty. Similarly, a Final state accepting PDA is a PDA for which a given input is accepted if on a given input string, when the input exhausts, thePDA should be in one of the final states. A Non-deterministic PDA or NPDA is a PDA in which, for a given input, multiple output is possible. i.e. The Transition function δ maps a given input from Q × Σ × Γ to a finite set of Q × Γ. For the given question, since there is a more than one output corresponding to a given input for transition function, we will consider a NPDA for the execution of the input and we will halt our execution for a corresponding branch if there is no move possible for a given input and We assume that if the machine halts at one of the final state and input is exhausted, we accept the string otherwise we reject it. Notice, the Given PDA is final state accepting PDA and not the empty stack accepting PDA. Choice of the Questions:   We will assume the initial stack symbol is ε, and   • In choice 1, The execution will be as follow: (s, a, ) → (s, a) or (f, ε). Let’s first consider, (s, a) as output and execute the remaining input. (s,a, a) → No valid Move. halt this branch and not in the final state, so not accepted. Now consider (f, ε) as output. (f, a, ε) → No Valid Move. halt this branch Notice that the PDA is in one of the final state, But the input string is not exhausted, So this should not be accepted by the PDA.   • In choice 2, The Execution will start as of choice 1 and will halt at character 2 as no possible move. This option is also not accepted in same way as of the first option. 3   • In choice 3, The execution will be as follow: (s, b, ε) → (s, a). (s, a, a) → No Possible move. halt this branch. Since halted before reaching to any final state so this option is not accepted.   • In choice 4, This option is also not accepted as the PDA will halt at second character as it halted in previous option. This option is also not accepted.   Assuming that if the PDA halts on a input due to no possible move and if the current state is one of the final state but the input is not exhausted, PDA will reject that string, For Question 2, Every answer is true i.e. None of the given for string belongs to the given PDA’s language. Again, Assuming that if the PDA halts on a input due to no possible move and if the current state is one of the final state but the input is not exhausted, the PDA will keep on consuming the input string until the end of string comes, string in option (A) and option (B) will be accepted by the language of this PDA. while option (C) and option (D) still won’t get accepted as by the end of the string, the PDA won’t be in final state. So keeping this assumption in mind, option (C) and option (D) both will be true for this question. This explanation is contributed by Durgesh Pandey.
 Question 54
Let L be a regular language and M be a context-free language, both over the alphabet Σ. Let Lc and Mc denote the complements of L and M respectively. Which of the following statements about the language Lc∪ Mc is TRUE
 A It is necessarily regular but not necessarily context-free B It is necessarily context-free. C It is necessarily non-regular. D None of the above
Regular languages and finite automata    Gate IT 2005
Discuss it

Question 54 Explanation:
Proposition: L is a regular language M is a context free language Derivation: L_c  union M_c = complement{L intersection M} Now, L intersection M is a CFL according to closure laws of CFLs, i.e. intersection of a CFL with RL is always a CFL. But, complement{L intersection M} might not be a CFL because complement over CFL doesn't guarantee a CFL. It can even be a RL or it might even lie outside the CFL circle. It will be a context-sensitive language certainly, but nothing else can be said about it. Conclusion: Considering the above derivation, none of the statements are true. Hence correct answer would be (D) None of the above. Related article : http://quiz.geeksforgeeks.org/theory-of-computation-closure-properties-of-context-free-languages/ This solution is contributed by Vineet Purswani.
 Question 55
Which of the following statements is TRUE about the regular expression 01*0?
 A It represents a finite set of finite strings. B It represents an infinite set of finite strings. C It represents a finite set of infinite strings. D It represents an infinite set of infinite strings
Regular languages and finite automata    Gate IT 2005
Discuss it

Question 55 Explanation:
First of all, A string can never be infinite because String is a finite sequence of symbols over Σ So option (c) and (d) are eliminated. And because of star(*) it can generate infinite set. So Option (B) is CORRECT.   This solution is contributed by Abhishek Agrawal.
 Question 56
The language {0n 1n 2n | 1 ≤ n ≤ 106} is
 A regular B context-free but not regular. C context-free but its complement is not context-free. D not context-free
Regular languages and finite automata    Gate IT 2005
Discuss it

Question 56 Explanation:

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
Consider the non-deterministic finite automaton (NFA) shown in the figure.
State X is the starting state of the automaton. Let the language accepted by the NFA with Y as the only accepting state be L1. Similarly, let the language accepted by the NFA with Z as the only accepting state be L2. Which of the following statements about L1 and L2 is TRUE? Correction in Question: There is an edge from Z->Y labeled 0 and another edge from Y->Z labeled 1 - in place of double arrowed and no arrowed edges.
 A L1 = L2 B L1 ⊂ L2 C L2 ⊂ L1 D None of the above
Regular languages and finite automata    Gate IT 2005
Discuss it

Question 57 Explanation:
A generic approach to solve such questions would be to come up with the corresponding regular languages and compare the two. Ardens theorem could be used to achieve the objective. Moreover, some conclusions could be drawn without even deriving the languages completely, solely from the intermediary equations. Constructing equations for every state -: X = Z0 +X1, Y = X0 +Y0 +Z0 && Z = X0 + Y1 + Z1. Clearly, regular languages L1 and L2 couldn’t be same. Now, to check which of the other three options are correct, we need to find : 1) a string which is accepted by L1 but not by L2. 2) a string which is accepted by L2 but not by L1. If there exists string 1) but not 2) then L2 ⊂ L1 and likewise. Trying our hands at the given DFA, 1) string 00 is accepted by L1 but not by L2 and 2) string 01 is accepted by L2 but not by L1. Hence, neither of the two languages our subset of the other. This solution is contributed by Vineet Purswani. Another solution. L1 can have 00 string while L2 can't. L2 can have 01 while L1 can't None of them can be either equal or proper subset of each other. So Ans. D.
 Question 58
A language L satisfies the Pumping Lemma for regular languages, and also the Pumping Lemma for context-free languages. Which of the following statements about L is TRUE?
 A L is necessarily a regular language. B L is necessarily a context-free language, but not necessarily a regular language C L is necessarily a non-regular language D None of the above
Regular languages and finite automata    Gate IT 2005
Discuss it

Question 58 Explanation:
Pumping lemma is negativity test. We use it to disprove that a languages is not regular. But reverse is not true.
 Question 59
Q83 Part_A Consider the context-free grammar E → E + E E → (E * E) E → id
where E is the starting symbol, the set of terminals is {id, (,+,),*}, and the set of nonterminals is {E}.
Which of the following terminal strings has more than one parse tree when parsed according to the above grammar?
 A id + id + id + id B id + (id* (id * id)) C (id* (id * id)) + id D ((id * id + id) * id)
Regular languages and finite automata    Gate IT 2005
Discuss it

Question 59 Explanation:

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
Q 83_Part B Consider the context-free grammar E → E + E E → (E * E) E → id
where E is the starting symbol, the set of terminals is {id, (,+,),*}, and the set of non-terminals is {E}.
For the terminal string id + id + id + id, how many parse trees are possible?
 A 5 B 4 C 3 D 2
Regular languages and finite automata    Gate IT 2005
Discuss it

Question 60 Explanation:
Background Required to solve the question - Parse Tree Construction.
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
Which of the following languages is generated by the given grammar?
S -> aS|bS|ε
 A A B B C C D D
Regular languages and finite automata    GATE-CS-2016 (Set 1)
Discuss it

Question 61 Explanation:
We can generate ε, a, ab, abb, b, aaa, .....
 Question 62
Which one of the following regular expressions represents the language: the set of all binary strings having two consecutive 0s and two consecutive 1s?
 A A B B C C D D
Regular languages and finite automata    GATE-CS-2016 (Set 1)
Discuss it

Question 62 Explanation:
Option A represents those strings which either have 0011 or 1100 as substring. Option C represents those strings which either have 00 or 11 as substring. Option D represents those strings which start with 11 and end with 00 or start with 00 and end with 11.
 Question 63
The number of states in the minimum sized DFA that accepts the language defined by the regular expression (0+1)*(0+1)(0+1)* is __________________ [Note that this question was originally asked as Fill-in-the-Blanks type]
 A 2 B 3 C 4 D 5
Regular languages and finite automata    GATE-CS-2016 (Set 2)
Discuss it

Question 63 Explanation:

So, the minimum number of states is 2.   Thus, B is the correct answer.
 Question 64
Consider the following two statements:
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?
 A Only I is true B Only II is true C Both I and II are true D Both I and II are false
Regular languages and finite automata    GATE-CS-2016 (Set 2)
Discuss it

Question 64 Explanation:
Statement I : False, Since there is no mention of transition between states. There may be a case, where between two states there is no transition defined. Statement II: True, Since any empty language (i.e., A = Φ ) is regular and its intersection with any other language is Φ. Thus A ∩ B is regular. This explanation has been contributed by Shikhar Goel.
 Question 65
In the automaton below, s is the start state and t is the only final state.               Consider the strings u = abbaba, v = bab, and w = aabb. Which of the following statements is true?
 A The automaton accepts u and v but not w B The automaton accepts each of u, v, and w C The automaton rejects each of u, v, and w D The automaton accepts u but rejects v and w
Regular languages and finite automata    GATE IT 2006
Discuss it

Question 65 Explanation:
For the acceptance and rejection of any string we can simply check for the movement on each input alphabet between states. A string is accepted if we stop at any final state of the DFA. For string u=abbaba the string ends at t (final state) hence it is accepted by the DFA. For string v=bab the string ends at s (non-final state) and hence rejected by the DFA. For string w=aabb the string ends at s (non-final state) and hence rejected by the DFA.   This solution is contributed by Yashika Arora.
 Question 66
In the context-free grammar below, S is the start symbol, a and b are terminals, and ϵ denotes the empty string S → aSa | bSb | a | b | ϵ Which of the following strings is NOT generated by the grammar?
 A aaaa B baba C abba D babaaabab
Regular languages and finite automata    GATE IT 2006
Discuss it

Question 66 Explanation:
The given Language is  Palindrome. A,C and D follow the language but  baba  is not a palindrome  , so B is the answer
 Question 67
Which regular expression best describes the language accepted by the non-deterministic automaton below?
 A (a + b)* a(a + b)b B (abb)* C (a + b)* a(a + b)* b(a + b)* D (a + b)*
Regular languages and finite automata    GATE IT 2006
Discuss it

 Question 68
Consider an ambiguous grammar G and its disambiguated version D. Let the language recognized by the two grammars be denoted by L(G) and L(D) respectively. Which one of the following is true ?
 A L (D) ⊂ L (G) B L (D) ⊃ L (G) C L (D) = L (G) D L (D) is empty
Regular languages and finite automata    Gate IT 2007
Discuss it

Question 68 Explanation:
By changing grammar, language will not change here. {as converting NFA to DFA language will not be changed}
 Question 69
Which of the following regular expressions describes the language over {0, 1} consisting of strings that contain exactly two 1's?
 A (0 + 1) * 11(0 + 1) * B 0 * 110 * C 0 * 10 * 10 * D (0 + 1) * 1(0 + 1) * 1 (0 + 1) *
Regular languages and finite automata    Gate IT 2008
Discuss it

Question 69 Explanation:
By looking at option A and D clearly not feasible solution.
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
Let N be an NFA with n states and let M be the minimized DFA with m states recognizing the same language. Which of the following in NECESSARILY true?
 A m ≤ 2n B n ≤ m C M has one accept state D m = 2n
Regular languages and finite automata    Gate IT 2008
Discuss it

Question 70 Explanation:
A state in a DFA is proper subset of states of NFA of corresponding DFA
=> set of states of NFA =n
=> no of subsets of a set with n elements = 2n
=> m<=2n
 Question 71
If the final states and non-final states in the DFA below are interchanged, then which of the following languages over the alphabet {a,b} will be accepted by the new DFA?
 A Set of all strings that do not end with ab B Set of all strings that begin with either an a or a b C Set of all strings that do not contain the substring ab, D The set described by the regular expression b*aa*(ba)*b*
Regular languages and finite automata    Gate IT 2008
Discuss it

Question 71 Explanation:
Seemingly, DFA obtained by interchanging final and non-final states will be complement of the given regular language. So, to prove that a family of string is accepted by complement of L, we will in turn prove that it is rejected by L. (A). Set of all strings that do not end with ab - This statement could be proved right by looking at the b labeled incident edges on the final states and a labeled edges preceding them. Complement of the given DFA will have first two states as final states. First state doesn’t have any b labeled edge that has a labeled edge prior to it. Similarly, second final state doesn’t have any such required b labeled edge. Similarly, it could be proven that all the strings accepted by the given DFA end with ab. Now that L ∪ complement(L) = (a + b) ∗ , L should be the set of all the strings ending on ab and complement(L) should be set of all the strings that do not end with ab. [CORRECT] (B). Set of all strings that begin with either an a or ab - This statement is incorrect. To prove that we just have to show that a string beginning with a or ab exists, which is accepted by the given DFA. String abaab is accepted by the given DFA, hence it won’t be accepted by its complement. [INCORRECT] (C). Set of all strings that do not contain the substring ab - To prove this statement wrong, we need to show that a string exists which doesn’t contain the substring ab and is not accepted by current DFA. Hence, it will be accepted by its complement, making this statement wrong. String aba is not accepted by this DFA. [INCORRECT] (D). The set described by the regular expression b ∗ aa ∗ (ba) ∗ b ∗ - String abaaaba is not accepted by the given DFA, hence accepted by its com This solution is contributed by vineet purswani.
 Question 72
Consider the following languages.

L1 = {ai bj ck | i = j, k ≥ 1}
L1 = {ai bj | j = 2i, i ≥ 0}
Which of the following is true?
 A L1 is not a CFL but L2 is B L1 ∩ L2 = ∅ and L1 is non-regular C L1 ∪ L2 is not a CFL but L2 is D There is a 4-state PDA that accepts L1, but there is no DPDA that accepts L2
Regular languages and finite automata    Context free languages and Push-down automata    Gate IT 2008
Discuss it

Question 72 Explanation:
A: Both L1 and L2 are CFL
B: L1 ∩ L2 = ∅ is true
L1is not regular => true
=> B is true
C: L1 ∪ L2 is not a CFL nut L2 is CFL is closed under Union
=> False
D: Both L1 and L2 accepted by DPDA
 Question 73
Which of the following languages is (are) non-regular? L1 = {0m1n | 0 ≤ m ≤ n ≤ 10000} L2 = {w | w reads the same forward and backward} L3 = {w ∊ {0, 1} * | w contains an even number of 0's and an even number of 1's}
 A L2 and L3 only B L1 and L2 only C L3 only D L2 only
Regular languages and finite automata    Gate IT 2008
Discuss it

Question 73 Explanation:
1. L 1 is a regular language, as it can be derived by a trivial DFA with 10000 states for each alphabet in the grammar to limit on the number of 0s and 1s to 10000. 2. L 2 is a set of all palindromic strings, which isn’t a regular language because there is no way for a finite automaton to remember which alphabets have occurred. 3. L 3 is a standard regular language as there exists a DFA which can derive this language. You can read more in the references about it. Reference : http://stackoverflow.com/questions/17420332/need-regular-expression-for-finite-automata-eve 17434694#17434694 This solution is contributed by vineet purswani.
 Question 74
Consider the following two finite automata. M1 accepts L1 and M2 accepts L2.

Which one of the following is TRUE?
 A L1 = L2 B L1 ⊂ L2 C L1 ∩ L2' = ∅ D L1 ∪ L2 ≠ L1
Regular languages and finite automata    Gate IT 2008
Discuss it

Question 74 Explanation:
 Question 75
Which of the following intuitive definition is true about LR(1) Grammar.
 A For a grammar to be LR(1) it is sufficient that a left-to-right shift reduce parser be able to recognize handles of right-sentential form when they appear on the stack. B For a grammar to be LR(1) it is sufficient that a left-to-right shift reduce parser be able to recognize handles of left-sentential form when they appear on the stack. C For a grammar to be LR(1) it is sufficient that a left-to-right shift reduce parser be able to recognize handles of left-sentential form or right-sentential form when they appear on the stack. D All of the above
Regular languages and finite automata    GATE 2017 Mock
Discuss it

Question 75 Explanation:
LR(1) – Reading the input string from left to right.
LR(1) – Deriving a right-most derivation for the string.
In the first choice we read from Left to right deriving the right-most sentential form and looking one symbol ahead which is stack top. So option (a) is correct.
 Question 76
Consider the Following regular expressions

r1 = 1(0 + 1)*
r2 = 1(1 + 0)+
r3 = 11*0

What is the relation between the languages generated by the regular expressions above ?
 A L (r1) ⊆ L (r2) and L(r1) ⊆ L(r3) B L (r1) ⊇ L (r2) and L(r2) ⊇ L(r3) C L (r1) ⊇ L (r2) and L(r2) ⊆ L(r3) D L (r1) ⊇ L (r3) and L(r2) ⊆ L(r1)
Regular languages and finite automata    GATE 2017 Mock
Discuss it

Question 76 Explanation:
Clearly r1 is a superset of both r2 and r3 as string 1 can not be generated by r2 and r3. r2 is a superset of r3 as string 11 is not present in L(r3) but in L(r2).
 Question 77
Consider regular expression r, where r = (11 + 111)* over Ʃ = {0, 1}. Number of states in minimal NFA and DFA respectively are:
 A NFA – 3, DFA – 4 B NFA – 3, DFA – 3 C NFA – 3, DFA – 3 D NFA – 4, DFA – 4
Regular languages and finite automata    GATE 2017 Mock
Discuss it

Question 77 Explanation:
For NFA: Just remove the trap state.
 Question 78
Consider the grammar G.
    E -> TE’
E’ -> +TE’ | ԑ
T’ -> FT’
T’ -> *FT’ | ԑ
F -> (E) | id

If 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)
 A 1 B 2 C 3 D 4
Regular languages and finite automata    GATE 2017 Mock
Discuss it

Question 78 Explanation:
First (E’) = {+ ,ԑ} Follow (E’) = {\$ , )}

Therefore 3 entries are present in E’ row
 Question 79
Let, init (L) = {set of all prefixes of L},
Let L = {w | w has equal number of 0’s and 1’s}
init (L) will contain:
 A all binary strings with unequal number of 0’s and 1’s B all binary strings with ԑ-string C all binary strings with exactly one more 0's than number of 1's D None of above
Regular languages and finite automata    GATE 2017 Mock
Discuss it

Question 79 Explanation:
Clearly init (L) = (0+1)*. Take any string in (0+1)* say 101011, we can append required number of symbols to make it a member of L like 10101100.
 Question 80
Suppose M1 and M2 are two TM’s such that L(M1) = L(M2). Then
 A On every input on which M1 doesn’t halt, M2 doesn’t halt too. B On every i/p on which M1 halts, M2 halts too. C On every i/p which M1 accepts, M2 halts. D None of above.
Regular languages and finite automata    GATE 2017 Mock
Discuss it

Question 80 Explanation:
M2 accepts strings in L(M1) so definitely it will halt. Other 2 are not guaranteed as Turing machine M does not accept w if it either rejects w by halting to a reject state or loops infinitely on w.
There are 80 questions to complete.

## GATE CS Corner

See Placement Course for placement preparation, GATE Corner for GATE CS Preparation and Quiz Corner for all Quizzes on GeeksQuiz.