Professional Documents
Culture Documents
Automataqueation
Automataqueation
Answer: (c)
Explanation:
S1 can be written as (00)^n where n >= 1. And S2 can be written as (00)^(m+n)
where m >=2 and n >= 1. S2 can be further reduced to (00)^x where x >= 3.
We can easily write regular grammars for both S1 and S2.
G1 -> G100/00 (For S1)
G2 -> G200/000000 (For S2)
Answer (D)
State ‘q’ is trap state. All other states are accept states. In state 00, DFA must
move to ‘q’ for input symbol 0. All (non-trap) states indicate names indicate the
characters seen before reaching that particular state. Option (D) is the only
option that follow these rules.
Please see GATE Corner for all previous year paper/solutions/explanations,
syllabus, important dates, notes, etc.
Please write comments if you find any of the answers/explanations incorrect, or
you want to share more information about the topics discussed above.
1) The lexical analysis for a modern language such as Java needs the
power of which one of the following machine models in a necessary and
sufficient sense?
(A) Finite state automata
(B) Deterministic pushdown automata
(C) Non-deterministic pushdown automata
(D) Turing machine
Answer (A)
Lexical analysis is the first step in compilation. In lexical analysis, program is
divided into tokens. Lexical analyzers are typically based on finite state
automata. Tokens can typically be expressed as different regular expressions:
An identifier is given by [a-zA-Z][a-zA-Z0-9]*
The keyword if is given by if.
Integers are given by [+-]?[0-9]+.
Which of the following finite state machines is a valid minimal DFA which
accepts the same language as D?
Answer (A)
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 bb+a which are not
accepted by given DFA.
1) Let P be a regular language and Q be context-free language such that Q
⊆ P. (For example, let P be the language represented by the regular
expression p*q* and Q be {pnqn|n ∈ N}). Then which of the following is
ALWAYS regular?
(A) P ∩ Q
(B) P – Q
(C) ∑* – P
(D) ∑* – Q
Answer (C)
The expression ∑* – P represents complement of P which is a regular
language. Complement of Regular languages is also regular. Then a DFA that
accepts the complement of L, i.e. ∑* – L, can be obtained by swapping its
accepting states with its non-accepting states.
4) Match all items in Group 1 with correct options from those given in
Group 2.
Group 1 Group 2
P. Regular expression 1. Syntax analysis
Q. Pushdown automata 2. Code generation
R. Dataflow analysis 3. Lexical analysis
S. Register allocation 4. Code optimization
Consider the languages L1 = and L2 = {a}. Which one of the following represents
L1 L2* U L1*
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 .{ } indicates an empty language.
Concatenation of with any other language is . It works as 0 in multiplication.
L1* = * which is { }. Union of and { } is { }
Question 2
WRONG
2 and 3 only
C
3 and 4 only
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
CORRECT
Given the language L = {ab, aa, baa}, which of the following strings are in L*?
1) abaabaaabaa
2) aaaabaaaa
3) baaaaabaaaab
4) baaaaabaa
1, 2 and 3
A
2, 3 and 4
B
1, 2 and 4
1, 3 and 4
D
Regular languages and finite automata
Discuss it
Question 3 Explanation:
See question 2 of http://www.geeksforgeeks.org/automata-theory-set-2/
Question 4
CORRECT
Given the language L = {ab, aa, baa}, which of the following strings are in L*?
1) abaabaaabaa
2) aaaabaaaa
3) baaaaabaaaab
4) baaaaabaa
1, 2 and 3
A
2, 3 and 4
B
1, 2 and 4
1, 3 and 4
D
Regular languages and finite automata
Discuss it
Question 4 Explanation:
See question 2 of http://www.geeksforgeeks.org/automata-theory-set-2/
Question 5
WRONG
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
Question 5 Explanation:
See http://www.geeksforgeeks.org/automata-theory-set-2/
Question 6
CORRECT
2^(n+1)
C
2^(k+1)
D
GATE CS 2011 Regular languages and finite automata
Discuss it
Question 6 Explanation:
See Question 3 of http://www.geeksforgeeks.org/automata-theory-set-4/
Question 7
CORRECT
D?
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
CORRECT
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?
n-1
A
n
B
n+1
2n-1
D
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
CORRECT
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)*?
The set of all strings containing the substring 00.
A
The set of all strings containing at most two 0’s.
B
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.
D
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
CORRECT
Which one of the following is FALSE?
There is unique minimal DFA for every regular language
A
Every NFA can be converted to an equivalent PDA.
B
Complement of every context-free language is recursive.
C
Every nondeterministic PDA can be converted to an equivalent deterministic PDA.
Question 10 Explanation:
Power of Deterministic PDA is not same as the power of Non-deterministic PDA.
Deterministic PDA cannot handle languages or grammars with ambiguity, but NDPDA
can handle languages with ambiguity and any context-free grammar. So every non-
deterministic PDA can not be converted to an equivalent deterministic PDA.
Which of the following statements is false?
Every NFA can be converted to an equivalent DFA
A
Every non-deterministic Turing machine can be converted to an equivalent
Question 11 Explanation:
CORRECT
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
B
B
C
C
D
D
Regular languages and finite automata GATE CS 2008
Discuss it
Question 12 Explanation:
All four states 11, 21, 22 , 12 are interpreted as P, Q, R and S. By looking at options we
can easily find out that →11 is P and 22(F) is R. Now say 12 is S and 21 is Q. Let’s
construct the transition table for ZxY. So, the
answer should be (A) but in the row for S, it should be P and Q and not Q and P. Please
comment below if you find anything wrong in the above post.
Question 13
WRONG
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 *
P - 2, Q - 1, R - 3, S - 4
P - 1, Q - 3, R - 2, S - 4
B
P - 1, Q - 2, R - 3, S - 4
P - 3, Q - 2, R - 1, S - 4
D
Regular languages and finite automata GATE CS 2008
Discuss it
Question 13 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.
WRONG
I and IV only
IV only
D
Regular languages and finite automata GATE CS 2008
Discuss it
Question 14 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 15
WRONG
Question 15 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.
CORRECT
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
15 states
11 states
B
10 states
C
9 states
D
Regular languages and finite automata GATE-CS-2007
Discuss it
Question 16 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 17
WRONG
Which of the following languages is
regular?
A
B
B
C
D
D
Regular languages and finite automata GATE-CS-2007
Discuss it
Question 17 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 18
WRONG
Consider the following Finite State Automaton. The language accepted by this
automaton is given by the regular
expression
A
A
B
D
D
Regular languages and finite automata GATE-CS-2007
Discuss it
Question 18 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 19
WRONG
Consider the automata given in previous question. The minimum state automaton
equivalent to the above FSA has the following number of states
1
A
2
3
C
4
Question 19 Explanation:
WRONG
A
A
B
D
D
Regular languages and finite automata GATE-CS-2014-(Set-1)
Discuss it
Question 20 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, corr
Question 21
WRONG
Question 21 Explanation:
So, q0, q1 and q2 are reachable states for the input string 0011, but q3 is not. So,
option (A) is answer.
Question 22
WRONG
DFA?
I) 0*1(1+00*1)*
II) 0*1*1+11*0*1
III) (0+1)*1
I and II only
Question 22 Explanation:
I) 0*1(1+00*1)*
II) 0*1*1+11*0*1
III) (0+1)*1
Question 23
CORRECT
Only (II)
B
Both (I) and (II)
C
Neither (I) nor (II)
D
Regular languages and finite automata GATE-CS-2014-(Set-2)
Discuss it
Question 23 Explanation:
L1.L2 is definitely regular, since regular languages are closed under concatenation. But
L1.L2 = { anbn | n ≥ 0 } is not correct. Because both variable are independent of each
other. L1.L2 = { anbm | n ≥ 0 , m ≥ 0 } is possible. Therefore, only statement (i) is TRUE.
Question 24
CORRECT
Question 24 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 25
WRONG
The length of the shortest string NOT in the language (over Σ = {a, b}) of the following
regular expression is ______________.
a*b*(ba)*a*
2
4
C
5
D
Regular languages and finite automata GATE-CS-2014-(Set-3)
Discuss it
Question 25 Explanation:
All the strings that can be generated till length-2 are definitely present in this language.
Now, let's look at the strings of length-3; {aaa, aab, aba, abb, baa, bab, bba, bbb} .
String "bab" cannot be generated from given language. so, the string "bab" is the
shortest string not acceptable by given regular expression.
Question 26
CORRECT
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
D
D
Regular languages and finite automata GATE-CS-2006
Discuss it
Question 26 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 27
CORRECT
Consider the regular language L = (111 + 11111)*. The minimum number of states in
any DFA accepting this languages is:
3
A
5
B
8
C
9
Question 27 Explanation:
WRONG
Question 28 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 29
WRONG
Df = Nf and Dp ⊂ Np
Question 29 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 30
WRONG
The following diagram represents a finite state machine which takes as input a binary
Question 30 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 31
WRONG
The following finite state machine accepts all those binary strings in which the number
Question 31 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 32
CORRECT
0 + (0 + 10)*
B
(0 + 1)* 10(0 + 1)*
C
none of these
D
Regular languages and finite automata GATE-CS-2003
Discuss it
Question 32 Explanation:
There is property of regular expression (a+b)* = (a*b*)* = (a*+b*)* = (a*+b)* = a*(ba*)*=
(b*a)*b*. (1*0)*1* can generate all strings that generated by given regular expression
0*(10*)*. So, option (A) is correct.
Question 33
WRONG
Consider the following deterministic finite state automaton
5
B
7
8
D
Regular languages and finite automata GATE-CS-2003
Discuss it
Question 33 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 34
WRONG
L1 ⊆ L
C
L1 = L
D
Regular languages and finite automata GATE-CS-2003
Discuss it
Question 34 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 35
WRONG
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
Outputs the sum of the present and the previous bits of the input.
Question 35 Explanation:
WRONG
The smallest finite automation which accepts the language {x | length of x is divisible by
3} has :
2 states
3 states
4 states
C
5 states
D
Regular languages and finite automata GATE-CS-2002
Discuss it
Question 36 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 37
WRONG
statements:
Only S1 is correct
Only S2 is correct
B
Both S1 and S2 are correct
C
None of S1 and S2 is correct
Question 37 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 38
WRONG
Given an arbitary non-deterministic finite automaton (NFA) with N states, the maximum
number of states in an equivalent minimized DFA is at least
N2
A
2N
2N
N!
D
Regular languages and finite automata GATE-CS-2001
Discuss it
Question 38 Explanation:
Refer http://en.wikipedia.org/wiki/Powerset_construction
Question 39
WRONG
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?
8
14
B
15
C
48
Question 39 Explanation:
WRONG
Which of the languages are regular?
Only L1 and L2
Question 40 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 , xy iz ∈ 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 xy iz ∉ 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 a nan. The length of the
string represented by language should be Even. Consider l = n, then xyz = a nan with xy =
an. lets assume y = a, then consider the membership of xy iz 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 = a pb, then string formed by L will be
apbapb which is of length 2p + 2. Assume l = p, then xy = a p. 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
CORRECT
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?
S⊂T
A
T⊂S
B
S=T
S∩T=φ
D
Regular languages and finite automata GATE-CS-2000
Discuss it
Question 41 Explanation:
Both have same output because if we draw DFA of S which is (a+b*)*, at final state it is
just repeating.
Question 42
WRONG
Let L denotes the language generated by the grammar S -> 0S0/00. Which of the
following is true?
L = 0+
A
L is regular but not 0+
Question 42 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 43
WRONG
What can be said about a regular language L over {a} whose minimal finite state
automaton has two states?
L must be {an| n is odd}
A
L must be {a | n is even}
B
n
L must be {an| ³ O}
Question 43 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 44
WRONG
Consider the following Deterministic Finite
Question 44 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 45
WRONG
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.
1
A
2
4
D
Regular languages and finite automata GATE-CS-2015 (Mock Test)
Discuss it
Question 45 Explanation:
Question 46
CORRECT
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
__________.
0
A
1
2
C
3
D
Regular languages and finite automata GATE-CS-2015 (Set 1)
Discuss it
Question 46 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 47
WRONG
Consider alphabet ∑ = {0, 1}, the null/empty string λ and the sets of strings X 0, X1 and
X2 generated by the corresponding non-terminals of a regular grammar. X 0, 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 X 0?
10 (0* + (10)*)1
10 (0* + (10)*)*1
B
1(0* + 10)*1
Question 47 Explanation:
The smallest possible string by given grammar is "11".
X0 = 1X1
= 11X2 [Replacing X1 with 1X2]
= 11 [Replacing X2 with λ]
WRONG
L2 only
B
L2 and L3 only
C
L3 only
Question 48 Explanation:
L3 is simple to guess, it is regular.
Below is DFA for L1.
WRONG
The number of states in the minimal deterministic finite automaton corresponding to the
regular expression (0 + 1)*(10) is ____________
2
4
C
5
D
Regular languages and finite automata GATE-CS-2015 (Set 2)
Discuss it
Question 49 Explanation:
Below is NFA for the given regular expression (0 +
1)*(10)
Question 50
WRONG
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)?
4
6
C
8
D
Regular languages and finite automata
Discuss it
Question 50 Explanation:
DFA for language represented by the regular expression Σ∗0011Σ∗ where Σ = {0, 1} is
as following below:
Th
e complement of above DFA will have same number of states but there will be non-final
states to final states and final state to non-final state. So, option (B) is correct.
Question 51
WRONG
Which one of the following regular expressions is NOT equivalent to the regular
expression (a + b + c) *?
(a* + b* + c*)*
(a*b*c*)*
B
((ab)* + c*)*
(a*b* + c*)*
D
Regular languages and finite automata GATE-IT-2004
Discuss it
Question 51 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 52
WRONG
aaa
A
aabab
baaba
bab
D
Regular languages and finite automata GATE-IT-2004
Discuss it
Question 52 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 53
CORRECT
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
It is necessarily regular but not necessarily context-free
A
It is necessarily context-free.
B
It is necessarily non-regular.
C
None of the above
Question 53 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 54
WRONG
Which of the following statements is TRUE about the regular expression 01*0?
It represents a finite set of finite strings.
A
It represents an infinite set of finite strings.
Question 54 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 55
WRONG
Question 55 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 56
WRONG
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.
L1 = L2
L1 ⊂ L2
L2 ⊂ L1
C
None of the above
D
Regular languages and finite automata Gate IT 2005
Discuss it
Question 56 Explanation:
According to Arden’s Theorem, For y as final state:
Y = X0 + Y0 + Z1
For z as final state:
Z = X0 + Y0 + Z1
Hence,
L(Y) = L(Z)
So, option (A) is correct.
Question 57
WRONG
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?
L is necessarily a regular language.
Question 57 Explanation:
Pumping lemma is negativity test. We use it to disprove that a languages is not regular.
But reverse is not true.
Question 58
WRONG
Question 58 Explanation:
WRONG
4
B
3
2
D
Regular languages and finite automata Gate IT 2005
Discuss it
Question 59 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:
WRONG
B
B
C
C
D
CORRECT
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
C
C
D
D
Regular languages and finite automata GATE-CS-2016 (Set 1)
Discuss it
Question 61 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 62
WRONG
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]
2
3
B
4
5
D
Regular languages and finite automata GATE-CS-2016 (Set 2)
Discuss it
Question 62 Explanation:
So, the minimum number of states is 2. Thus, B is the correct answer.
Question 63
WRONG
Only II is true
Question 63 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 64
WRONG
In the automaton below, s is the start state and t is the only final state.
Question 64 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 65
CORRECT
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?
aaaa
A
baba
abba
C
babaaabab
D
Regular languages and finite automata GATE IT 2006
Discuss it
Question 65 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 66
WRONG
Which regular expression best describes the language accepted by the non-
(abb)*
B
(a + b)* a(a + b)* b(a + b)*
(a + b)*
D
Regular languages and finite automata GATE IT 2006
Discuss it
Question 67
WRONG
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 ?
L (D) ⊂ L (G)
A
L (D) ⊃ L (G)
B
L (D) = L (G)
L (D) is empty
Question 67 Explanation:
By changing grammar, language will not change here. {as converting NFA to DFA
language will not be changed}
Question 68
WRONG
Which of the following regular expressions describes the language over {0, 1} consisting
of strings that contain exactly two 1's?
(0 + 1) * 11(0 + 1) *
0 * 110 *
B
0 * 10 * 10 *
(0 + 1) * 1(0 + 1) * 1 (0 + 1) *
D
Regular languages and finite automata Gate IT 2008
Discuss it
Question 68 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 69
WRONG
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?
m ≤ 2n
n≤m
B
M has one accept state
m = 2n
D
Regular languages and finite automata Gate IT 2008
Discuss it
Question 69 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 70
CORRECT
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?
Set of all strings that do not end with ab
Question 70 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 71
WRONG
L1 = {ai bj ck | i = j, k ≥ 1}
L1 = {ai bj | j = 2i, i ≥ 0}
Which of the following is true?
L1 is not a CFL but L2 is
Question 71 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 72
WRONG
L2 only
Question 72 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 73
WRONG
Consider the following two finite automata. M1 accepts L1 and M2 accepts L2.
L1 ⊂ L2
B
L1 ∩ L2' = ∅
L1 ∪ L2 ≠ L1
D
Regular languages and finite automata Gate IT 2008
Discuss it
Question 73 Explanation:
Question 74
WRONG
able to recognize handles of right-sentential form when they appear on the stack.
B able to recognize handles of left-sentential form when they appear on the stack.
For a grammar to be LR(1) it is sufficient that a left-to-right shift reduce parser be
Question 74 Explanation:
LR(1) – Reading the input string from left to right.
LR(1) – Deriving a right-most derivation for the string.
LR(1) – one token look-ahead
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 75
CORRECT
r1 = 1(0 + 1)*
r2 = 1(1 + 0)+
r3 = 11*0
What is the relation between the languages generated by the regular expressions above
?
L (r1) ⊆ L (r2) and L(r1) ⊆ L(r3)
A
L (r1) ⊇ L (r2) and L(r2) ⊇ L(r3)
Question 75 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 76
CORRECT
Consider regular expression r, where r = (11 + 111)* over Ʃ = {0, 1}. Number of states in
minimal NFA and DFA respectively are:
NFA – 3, DFA – 4
NFA – 3, DFA – 3
B
NFA – 3, DFA – 3
C
NFA – 4, DFA – 4
D
Regular languages and finite automata GATE 2017 Mock
Discuss it
Question 76 Explanation:
WRONG
Question 77 Explanation:
First (E’) = {+ ,ԑ} Follow (E’) = {$ , )}
WRONG
all binary strings with exactly one more 0's than number of 1's
None of above
D
Regular languages and finite automata GATE 2017 Mock
Discuss it
Question 78 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 79
WRONG
Suppose M1 and M2 are two TM’s such that L(M1) = L(M2). Then
On every input on which M1 doesn’t halt, M2 doesn’t halt too.
None of above.
D
Regular languages and finite automata GATE 2017 Mock
Discuss it
Question 79 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.
Question 80
CORRECT
Consider the regular expression (0+1)(0+1)... n times. The minimum state finite
automaton that recognizes the language represented by this regular expression
contains:
n states
A
n+1 states
n+2 states
C
None of the above
D
Regular languages and finite automata GAT
Question 81
[5 Marks question] a. Given that A is regular and A∪B is regular, does it follow that B is
necessarily regular? Justify your answer. b. Given two finite automata M1, M2, outline
an algorithm to decide if L(M1)⊆L(M2). (note: strict subset)
Regular languages and finite automata GATE CS 1999
Discuss it
Question 82
WRONG
If the regular set 'A' is represented by A= (01+1)* and the regular set 'B' is represented
by B= ((01)* 1*)*, which of the following is true ?
A⊂B
A
B⊂A
Question 82 Explanation:
Some of the regular expression always equivalent to (0+1)* such that
(0+1)*
= (0*+1*)*
= (01*)*
= (0*+1)*
= (0+1*)*
= 0*(10*)*
= 1*(01*)*
Since,
(01+1)* = ((01)* 1* )*
Therefore A = B.
Question 83
CORRECT
C of ones.
The set {1, 101, 11011, 1110111,.......}
D
Regular languages and finite automata GATE CS 1998
Discuss it
Question 83 Explanation:
If there is a infinite language and for that language if their is no any pattern exist then
we can surely say that given language is not regular, but if pattern is exist for that
language then it may or may not be regular language and for ensuring a given language
is regular, if we are able to draw DFA for that language then surely it will be regular
otherwise not regular, Therefore option (A) is regular language as it can written in binary
i.e.,
L = {1, 10, 100, 1000, 10000, …}
Regular expression is (10*), since, for this expression we can draw DFA. So, option (A)
is correct.
Question 84
WRONG
1(0+1)* 101
B
(10)* (01)* (00+11)*
(00+(11)*0)*
Question 84 Explanation:
R.E of option C won’t generate 1101 as you can see the language will contain L(C) =
{epsilon,10,1010,1001,0101,00,11,0011,1100,………..} Also, R.E of option D has ‘1’ but
here two ’11’ are together hence its impossible to generate 1101.L(D) =
{Epsilon,0,00,110,11110,11000,…………….} Here Option (C) and (D) both are correct.
Question 85
WRONG
Let L be the set of all binary strings whose last two symbols are same. The number of
states in the minimal state deterministic finite-state automaton accepting L is
2
A
5
3
D
Regular languages and finite automata GATE CS 1998
Discuss it
Question 86
WRONG
Question 86 Explanation:
Taking a counter example, suppose,
L1 = { a^n b^m |n ,m >=0} is always regular
L2 = { a^n b^n | n >=0} is not regular
L1 ⋂ L2 = L2
L2 which is non regular but L1 is subset of L2. Therefore Every subset of a regular set is
not regular. Option (B) is correct.
Question 87
[Subjective type] Given a regular expression for the set of binary strings where every 0
is immediately followed by exactly k 1's and preceded by atleast k 1's (k is a fixed
integer).
Regular languages and finite automata GATE CS 1998
Discuss it
Question 88
[Subjective type] Design a deterministic finite state automaton (using minimum number
of states) that recognizes the following language:
L = { w ∈ {0,1}* | w interpreted as a binary number (ignoring the
leading zeros) is divisible by 5 }
Regular languages and finite automata GATE CS 1998
Discuss it
Question 89
WRONG
Which one of the following regular expressions over {0,1} denotes the set of all strings
not containing 100 as a substring?
0* (1+0)*
A
0*1010*
B
0*1*01*
0*(10+1)*
Question 89 Explanation:
According to given question, it should generate all other string / substring, but in given
options :
(A) generates 100
(B) doesn't generate 0
(C) doesn't generate 1
Only option (D) is correct.
Question 90
Construct a finite state machine with minimum number of states, accepting all strings
over {a, b} such that the number of a's is divisible by two and the number of b's is
divisible by three.
Question 91
Given that L is a language accepted by a finite state machine, show that L P and LR are
also accepted by some finite state machines, where
LP = {s | ss' ∈ L, for some string s' }
LR = {s | s obtainable by reversing some string in L }
Regular languages and finite automata GATE CS 1997
Discuss it
Question 92
Question 93
WRONG
Which two of the following four regular expressions are equivalent? (ε is the empty
string). (i). (00)*(ε+0) (ii). (00)* (iii). 0* (iv). 0(00)*
(i) and (ii)
A
(ii) and (iii)
Question 93 Explanation:
Here,
(00)*(ε+0)
= (00)*.ε+ (00)*.0
= (00)* + (00)*0
= 0*
It is equal to (iii) [ using regular expression properties ]. Here, we see that (00)*
generates strings of even length and (00)*0 generated the strings of odd length. Option
(C) is correct.
Question 94
WRONG
Question 94 Explanation:
For option (A) :- L = { x | x has an equal number of a's and b's } is regular for equal
number of a’s and b’s we need s stack for to store the number of a’s and we push all a’s
into the stack and pop all b’s for each a’s hence, a cannot be regular language. For
option (B) :- L = { anbn | n ≥ 1 } is regular is also not regular , it is same as above
language. This language also says that equal number of a’s followed by equal number
of b’s so it also need a stack to push all a’s and pop all b’s for each a’s. For option (C) :-
L= { x | x has more a's than b's } is also not regular it is also CFL we need stack here for
a should be greater than b. For option (D) :- L = {ambn | m ≥ 1, n ≥ 1 } is regular language
because there is no restriction that equal number of a’s and b’s this language only says
that a should be followed by b therefore we can draw a DFA for it. Option (D) is correct.
Question 95
CORRECT
Consider the given figure of state table for a sequential machine. The number of states
2
C
1
D
Regular languages and finite automata GATE CS 1996
Discuss it
Question 96
Given below are the transition diagrams for two finite state machine M 1 and
M2 recognizing languages L1 and
L2 respectively. . a) Display the
transition diagram for a machine that recognizes L 1 . L2, obtained from transition
diagrams for M1 and M2 by adding only ε transitions and no new states. b) Modify the
transition diagram obtained in part(a) obtain a transition diagram for a machine that
recognizes (L1.L2)∗ by adding only ε transitions and no new states. (Final states are
enclosed in double circles).
Regular languages and finite automata GATE CS 1996
Discuss it
Question 97
WRONG
Consider the regular language La with input alphabets ‘a’ and ‘b’ in which count of ‘a’
and ‘b’ are odd as:
La = {w∈{a,b}* ∣|w|a∈2N+1 and |w|b∈2N+1}
What will be the minimum number of states in DFA corresponding to L a :
4
5
B
3
6
D
Regular languages and finite automata GATE CS Mock 2018
Discuss it
Question 97 Explanation:
DFA will be : So, answer is 4 states.
Question 98
CORRECT
A regular expression is ambiguous when there exists a string which can be constructed
in two different ways from the regular expression. Which of the following regular
expressions are unambiguous?
a((ab)*cd)* ∪ a(ababcb*)*a*
A
aab*(ab)* ∪ ab* ∪ a*bba*
B
aaba* ∪ aaaba ∪ aabba* ∪ a
None of these
D
Regular languages and finite automata GATE CS Mock 2018
Discuss it
Question 98 Explanation:
(A) Ambiguous. For instance, the string a can be constructed by using a((ab)*cd)* or
a(ababcb*)*a*. (B) Ambiguous. The string abb can be constructed either by ab* or
a*bba*. (C) Unambiguous. Option (C) is correct.
Question 99
WRONG
Question 99 Explanation:
(I) Not regular. It is the same language as {a nbm | n ≠ m} which is the complement to
{anbm | n = m} which is not regular. Since regularity is closed under complementation, the
considered language can not be regular (since it would imply that {a nbm | n = m} is
regular). (II) Regular. The language can be described by the regular expression a*b*.
(III) Regular. This language is empty so finite and regular. (IV) Not regular. Its {a nbm |
n≥m ∧ n≤m } = {anbm | n = m} which is not regular. Therefore, option (B) is correct.
Question 100
CORRECT
Let L1, L2 be any two context-free languages and R be any regular language. Then
which of the following is/are False? (I) (L1)'∪L2∪L1 is context-free (II) R'∪L2 is context-
free (III) R∩L1∩L2 is context-free (IV) R∩L2 is context-free
I, II and IV only
A
I and III only
II and IV only
C
I only
D
Regular languages and finite automata GATE CS Mock 2018 | Set 2
Discuss it
CORRECT
Which of following statement(s) is/are not correct? (I) Languages generated by the
grammar S→aSa ∣ aa is not regular. (II) Languages generated by the grammar S→aSb
∣ aa is not regular. (III) Languages generated by the grammar S→S1|S3, S1→aS1c |S2|
λ, S2→aS2b|λ, S3→aS3b|S4| λ, S4→bS4c|λ is {a^nb^mc^k | k = |n - m|, n≥0, m≥0,
k≥0}. (IV) Languages generated by the grammar S→S1S3, S1→aS1c |S2|λ, S2→aS2b|
λ, S3→aS3b|S4| λ, S4→bS4c|λ is {a^nb^mc^k | k = |n - m|, n≥0, m≥0, k≥0}.
Only (II), (IV)
A
Only (I), (III), (IV)
CORRECT
6
D
Regular languages and finite automata GATE CS Mock 2018 | Set 2
Discuss it
CORRECT
Let δ denote the transition function and α denoted the extended transition function of the
ε-NFA whose transition table is given below:
None of these
D
Regular languages and finite automata GATE CS Mock 2018 | Set 2
Discuss it
WRONG
Let N be an NFA with n states. Let k be the number of states of a minimal DFA which is
equivalent to N. Which one of the following is necessarily true?
k ≥ 2n
A
k≥n
B
k ≤ n2
k ≤ 2n
WRONG
The order of a language L is defined as the smallest k such that L k=Lk+1. Consider the
language L1 (over alphabet 0) accepted by the following automaton.
3
1
C
None
D
Regular languages and finite automata GATE CS 2018
Discuss it
CORRECT
0+1*0*1*
D
Regular languages and finite automata UGC-NET CS 2017 Nov - II
Discuss it
CORRECT
WRONG
L1 ∩ L2 ∩ L3 is recursively enumerable
L1 ∪ L2 is context free
C
L1 ∩ L2 is context free
D
Regular languages and finite automata Context free languages and Push-down
automata Recursively enumerable sets and Turing machines ISRO CS 2017
Discuss it
WRONG
WRONG
WRONG
PDA
WRONG
(L.D) *
B
L(L + D) *
L(L.D) *
D
Regular languages and finite automata ISRO CS 2017 - May
Discuss it
WRONG
Which of the following strings would match the regular expression : p+ [3 – 5]∗ [xyz]? I.
p443y II. p6y III. 3xyz IV. p35z V. p353535x VI. ppp5
I, III and VI only
A
IV, V and VI only
WRONG
WRONG
Which of the following are not regular? (A) Strings of even number of a’s. (B) Strings of
a’s, whose length is a prime number. (C) Set of all palindromes made up of a’s and b’s.
(D) Strings of a’s whose length is a perfect square.
(A) and (B) only
A
(A), (B) and (C) only
B
(B), (C) and (D) only
WRONG
The number of strings of length 4 that are generated by the regular expression (0 +1+|
2+3+)*, where | is an alternation character and {+, *} are quantification characters, is:
08
A
09
10
12
D
Regular languages and finite automata UGC NET CS 2016 Aug – II
Discuss it
WRONG
WRONG
The number of states required by a Finite State Machine, to simulate the behavior of a
computer with a memory capable of storing 'm' words, each of length 'n' bits is?
m x 2n
A
2
B
m+n
2mn
m+n
WRONG
How many states are there in a minimum state deterministic finite automation accepting
the language L = {w | w {0,1} number of 0's is divisible by 2 and number of 1's is
divisible by 5, respectively} ?
7
A
9
10
11
D
Regular languages and finite automata ISRO CS 2014
Discuss it
CORRECT
The following Finite Automaton recognizes which of the given
languages?
{1, 0}* {01}
WRONG
S → S1 | S2 S1 → aaa S1| aA1 S2 → aaS2| A2 A1 → b A1| λ A2 → b A2| λ
C
S → S1 | S2 S1 → aa S1| A1 S2 → aaS2| A2 A1 → bb A1| λ A2 → bb A2| λ
WRONG
Consider the following identities for regular expressions: (a) (r + s)* = (s + r)* (b) (r*)* =
r* (c) (r* s*)* = (r + s)* Which of the above identities are true?
(a) and (b) only
CORRECT
Question 127
WRONG
WRONG
The number of strings of length 4 that are generated by the regular expression (0|∈)1+2*
(3|∈), where | is an alternation character, {+, *} are quantification characters, and ∈ is
the null string, is :
08
A
10
B
11
12
WRONG
The regular expression for the complement of the language L = {a nbm|n ≥ 4, m ≤ 3} is:
(λ + a + aa + aaa) b* + a* bbbb* + (a + b)* ba(a + b)*
WRONG
Let L be the language generated by regular expression 0*10* and accepted by the
deterministic finite automata M. Consider the relation R M defined by M. As all states are
reachable from the start state, RM has _____ equivalence classes.
2
4
B
5
C
6
Regular languages and finite automata UGC NET CS
Question 131
WRONG
What are the final states of the DFA generated from the following
NFA?
q0, q1, q2
[q0, q1], q2
D
Regular languages and finite automata ISRO CS 2013
Discuss it
WRONG
Match the
following:
(1)
A
(2)
B
(3)
(4)
CORRECT
There are exactly __________ different finite automata with three states x, y and z over
the alphabet {a, b} where x is always the start state.
64
A
56
B
1024
C
5832
Question 134
WRONG
001111
Question 135
WRONG
Minimal deterministic finite automaton for the language L = {0 n | n ≥ 0, n ≠ 4} will have:
1 final state among 5 states
A
4 final states among 5 states
B
1 final state among 6 states
Ther
e are 5 final states among 6 states. So, option (D) is correct.
Question 136
WRONG
The regular expression corresponding to the language L where L = { x ϵ {0, 1}*|x ends
with 1 and does not contain substring 00 } is:
(1 + 01) * (10 + 01)
(1 + 01) * 01
B
(1 + 01) * (1 + 01)
(10 + 01) * 01
D
Regular languages and finite automata UGC NET CS 2015 Jun - III
Discuss it
CORRECT
The transition function for the language L = {w|n a (w) and nb(w) are both odd} is given
by: δ (q0, a) = q1 ; δ (q0, b) = q2 δ (q1, a) = q0 ; δ (q1, b) = q3 δ (q2, a) = q3 ; δ (q2, b) = q0 δ
(q3, a) = q2 ; δ (q3, b) = q1 The initial and final states of the automata are:
q0 and q0respectively
A
q and q respectively
B 0 1
q and q respectively
C 0 2
q0 and q3respectively
odd}: q3 satisf
ies the condition - {w|na (w) and nb(w) are both odd} , so q3 is final state and all strings
starts from q0 so q0 is final state. So, option (D) is correct.
Question 138
CORRECT
Given two languages: L1 = {(ab) n ak | n > k, k ≥ 0} L2 = {an bm| n ≠ m} Using pumping
lemma for regular language, it can be shown that
L1 is regular and L2 is not regular.
A
L is not regular and L is regular.
B 1 2
CORRECT
Question 140
WRONG
The FSM (Finite State Machine) machine pictured in the figure
above
Complements a given bit pattern
A
Finds 2's complement of a given bit pattern
B
Increments a given bit pattern by 1
Regular
Two finite state machines are said to be equivalent if they:
Have the same number of edges
WRONG
The finite state machine given in figure below
recognizes:
any string of odd number of a’s
A
any string of odd number of b’s
B
any string of even number of a’s and odd number of b’s
CORRECT
A pushdown automata behaves like a Turing machine when the number of auxiliary
memory is:
0
A
1
B
1 or more
C
2 or more