Professional Documents
Culture Documents
1.Consider a DFA over ={a,b}accepting all strings which have number of as divisible by 6
and number of bs divisible by 8. What is the minimum number of states that the DFA will
have?
(1) 8
(2) 14
(3) 15
(4) 48
Solution: 3
[Gate-2001]
Solution:1
[Gate-2001]
GATE MATERIAL
Solution:2
[Gate-2001]
1) (1*0)*1*
2) 0 + (0 + 10)*
3) (0 + 1)* 10(0 + 1)*
4) none of these
Solution:4
[Gate-2003]
Solution: 1
[Gate-2003]
GATE MATERIAL
Solution: 3
[Gate-2003]
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
1) 1
2) 5
Solution:1
3) 7
4) 8
[Gate-2003]
3) Both L and
IT DEPARTMENT
are recursive
GATE MATERIAL
[Gate-2003]
1) L1 = {0, 1}* - L
2) L1 = {0, 1}*
3) L1
4) L1 = L
Solution:3
IT DEPARTMENT
[Gate-2003]
GATE MATERIAL
10. The following finite state machine accepts all those binary strings in which the
number of l's and 0's are respectively
1) divisible by 3 and 2
2) odd and even
3) even and odd
4) divisible by 2 and 3
Solution:1
[Gate-2004]
1) regular
2) context-free but not regular
3) context sensitive but not context free
4) type-0 but not context sensitive
Solution:2
[Gate-2004]
IT DEPARTMENT
GATE MATERIAL
Let Na (w) and Nb (w) denote the number of a's and b's in a string w
respectively. The language L(G)
{0, 1, 2, ...}}
4) { w | Nb (w) = 3k, k
{0, 1, 2, ...}}
Solution:3
[Gate-2004]
Solution:2
[Gate-2004]
IT DEPARTMENT
GATE MATERIAL
[Gate-2005]
Nf and Dp
Np
2) Df
Nf and Dp = Np
3) Df = Nf and Dp = Np
4) Df = Nf and Dp
Solution:4
Np
[Gate-2005]
GATE MATERIAL
L1 = {an bn cm | n, m > 0} and L2 = {an b mcm | n, m > 0} Which one of the following
statements is FALSE?
1) L1 L2 is a context-free language
2) L1
L2 is a context-free language
Solution: 1
[Gate-2005]
{0, 1}*}
{0, 1}*}, where # is a special symbol
(0, 1}*)
1) L1 is a deterministic CFL
2) L2 is a deterministic CFL
3) L3 is a CFL, but not a deterministic CFL
4) L3 is a deterministic CFL
Solution: 2
[Gate-2005]
18. The following diagram represents a finite state machine which takes as input
a binary number from the least significant bit.
IT DEPARTMENT
GATE MATERIAL
Solution: 2
[Gate-2005]
19. 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 ?
1) L = {s
2) L = {s
3) L = {s
4) L = {s
Solution:2
20. For s
Let L = {s
[Gate-2006]
(0 + 1) * let d(s) denote the decimal value of s (e.g. d (101) = 5).
(0 + 1)* | d (s) mod 5 = 2 and d (s) mod 7 4) Which one of the following
statements is true ?
GATE MATERIAL
Solution:2
[Gate-2006]
21. Consider the following statements about the contextfree grammar, G = (S SS, S ab, S ba, S )
I. G is ambiguous
II. G produces all strings with equal number of a's and b's
III. G can be accepted by a deterministic PDA
Which combination below expresses all the true statements about G?
1) I only
2) I and III only
3) II and III only
4) I, II, and III
Solution:4
22. Let L1
[Gate-2006]
be regular language,
L2
be a deterministic context-free
[Gate-2006]
GATE MATERIAL
23. Consider the regular language L = (111 + 11111)*. The minimum number of states
in any
DFA accepting this languages is
1) 3
2) 5
3) 8
Solution:4
4) 9
[Gate-2006]
Solution:2
[Gate-2007]
Solution:2
[Gate-2007]
has
IT DEPARTMENT
GATE MATERIAL
1) 15 states
2) 11 states
3) 10 states
4) 9 states
Solution: 1
[Gate-2007]
1) not recursive
2) is recursive and is a deterministic CFL
3) is a regular language
4) is not a deterministic CFL but a CFL
Solution: 2
[Gate-2007]
Solution:3
[Gate-2007]
29. Consider the grammar with non-terminals N = {S, C, S1), terminals T = {a, b, i, t, e},
with S as the start symbol, and the following set of rules
IT DEPARTMENT
GATE MATERIAL
S iCtSS1 | a
S1 eS|
Cb
The grammar is NOT LL(1) because:
1) It is left recursive
2) it is right recursive
3) it is ambiguous
4) it is not context-free
Solution:3
[Gate-2007]
30. Consider the following two statements : P : Every regular grammar is LL (1)
Q : Every regular set has a LR
(1) grammar
Which
of
the
following is TRUE ?
Solution:2
IT DEPARTMENT
[Gate-2007]
GATE MATERIAL
31. The language accepted by this automaton is given by the regular expression
1) b * ab * ab * ab *
2) (a + b) *
3) b * a (a + b) *
4) b * ab * ab *
Solution:3
[Gate-2007]
32. The minimum state automaton equivalent to the above FSA has the following number
of states
1) 1
2) 2
3) 3
Solution:2
4) 4
[Gate-2007]
GATE MATERIAL
Solution:4
[Gate-2008]
1) I and II
2) I and IV
3) II and III
4) II and IV
Solution:2
[Gate-2008]
35. If L and
1) regular
2) context-free
3) context-sensitive
4) recursive
Solution:4
[Gate-2008]
IT DEPARTMENT
GATE MATERIAL
Solution:4
[Gate-2008]
37. Which of the following statements are true?
I.
vice- versa
All -productions
II.
suitable transformations
III. The language generated by a context-free grammar all of whose productions are of
the form X w or X wY (where, w is a string of terminals and Y is a non-terminal),
is always regular
IV. The derivation trees of strings generated by a context-free grammar in
Chomsky
Normal Form are always binary
trees
1) I, II, III and IV
2) II, III and IV only
3) I, III and IV only
4) I, II and IV only
Solution:4
[Gate-2008]
formal
parameters in
GATE MATERIAL
Arithmetic expression
with matched
(R) L = {wcw | w (a | b) *}
(S) X b X b | c X c |
1) E P, F R, G Q, H S
2) E R, F P, G S, H Q
3) E R, F P, G Q, H S
4) E P, F R, G S, H Q
Solution:3
[Gate-2008]
39. 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*
IT DEPARTMENT
GATE MATERIAL
1) P 2, Q 1, R 3, S 4
2) P 1, Q 3, R 2, S 4
3) P 1, Q 2, R 3, S 4
4) P 3, Q 2, R 1, S 4
Solution:3
[Gate-2008]
{an b2m | n 0, m 0}
{a, b}*}
1) I and IV only
2) I and III only
3) I only
4) IV only
Solution:1
[Gate-2008]
41. S aSa | bSb | a | b; The language generated by the above grammar over the
alphabet
{a, b} is the set of
1) All palindromes.
2) All odd length palindromes.
3) Strings that begin and end with the same symbol.
IT DEPARTMENT
GATE MATERIAL
Solution:2
[Gate-2009]
42. 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)*?
Solution:3
[Gate-2009]
Solution:4
[Gate-2009]
IT DEPARTMENT
GATE MATERIAL
L1 = {am bm c an bm | m,
n 0} L2 = {aibjck | i, j, k
0}
Then L is
1) Not recursive
2) Regular
3) Context free but not regular
4) Recursively enumerable but not context free
Solution:3
[Gate-2009]
45.
The above DFA accepts the set of all strings over {0, 1} that
Solution:3
46. Let L = {
[Gate-2009]
(0 + 1) * | has even number of 1s}, i.e. L is the set of all
bit strings with even number of 1s. Which one of the regular expressions
below represents L ?
IT DEPARTMENT
GATE MATERIAL
1) (0 * 10 * 1) *
2) 0 * (10 * 10 * ) *
3) 0 * (10 * 1 *) * 0 *
4) 0 * 1(10 * 1) * 10 *
Solution:2
[Gate-2010]
Solution:1
[Gate-2010]
48. Let be any string of length n in {0, 1}*. Let L be the set of all
substrings
of. What is the minimum number of states in a non-deterministic
finite automaton that accepts L ?
1) n - 1
2) n
3) n + 1
4) 2n - 1
IT DEPARTMENT
GATE MATERIAL
Solution:3
[Gate-2010]
49. What is the complement of the language accepted by the NFA show below?
Assume = {a} and is the empty string.
(1)
(2) {}
Solution:2
(3) a G
(4) {a, }
[Gate-2011]
50.
Solution:B
[Gate-2012]
GATE MATERIAL
P : S aSa
S aAa
A bB
B bB
B c is
a.
b.
c.
d.
is type 3
is type 2 but not type 3
is type 1 but not type 2
is type 0 but not type 1
CD
CD
CE
aC
bE
bc is
a.
b.
c.
d.
is type 3
is type 2 but not type 3
is type 1 but not type 2
is type 0 but not type 1
IT DEPARTMENT
GATE MATERIAL
T = {a, b, c}
P : S aS
A bB
B cC
C a is
a.
b.
c.
d.
is type 3
is type 2 but not type 3
is type 1 but not type 2
is type 0 but not type 1
DE
aD
bE
c is
a.
b.
c.
d.
is type 3
is type 2 but not type 3
is type 1 but not type 2
is type 0 but not type 1
Aa
B bS
A aS
IT DEPARTMENT
GATE MATERIAL
S aB
S bA
B aBB A bAA
This derivation is
a.
b.
c.
d.
a leftmost derivation
a rightmost derivation
both leftmost and rightmost derivation
neither leftmost nor rightmost derivation
GATE MATERIAL
GATE MATERIAL
Aa
Bb
a.
b.
c.
d.
{anbncmdm|n, m 1}
{anbmcpdq|n = p or m = q, n, m, p, q 1}
{anbmcpdq|n m p q}
{anbmcpdq|n m p q}
a.
b.
c.
d.
00111
01010
00110
11010
IT DEPARTMENT
GATE MATERIAL
a.
b.
c.
d.
00111
11011
01101
0101
No
Yes
sometimes
depends on NFA
a.
b. L* = L+ {}
c. L* = L+
d. L* = L+ {}
66. The concept of FSA is much used in this part of the compiler
a.
b.
c.
d.
lexical analysis
parser
code generation
code optimization
67. The concept of grammar is much used in this part of the compiler
a.
b.
c.
d.
lexical analysis
parser
code generation
code optimization
{a(cd)nb|n 1}
{a(cd)na|n 1} {b(cd)nb/n 1}
{a(cd)na|n 0} {a(cd)nb/n 0} {b(cd)na/n 0} {b(cd)nb/n 0}
{acndnb|n 1}
GATE MATERIAL
a. {bnamcp|n, m, p 1}
b. {banc|n 0}
c. {banc|n 1}
70. The set of all strings over the alphabet = {a, b} (including ) is denoted by
a.
b.
c.
d.
(a + b)*
(a + b)+
a+b+
a*b*
360
120
35
36
CFL
CSL
recursive
regular
75. Which of the following regular expressions denotes a language comprising of all possible
strings over = {a, b} of length n where n is a multiple of 3.
IT DEPARTMENT
GATE MATERIAL
a.
b.
c.
d.
(a + b + aa + bb + aba + bba)*
(aaa + bbb)*
((a + b)(a + b)(a + b))*
(aaa + ab + a) + (bbb + bb + a)
76. A language is represented by a regular expression (a)*(a + ba). Which of the following string
does not belong to the regular set represented by the above expression.
a.
b.
c.
d.
aaa
aba
ababa
aa
77. Which of the following is not primitive recursive but partially recursive?
a.
b.
c.
d.
McCarthys function
Riemann function
Ackermanns function
Bounded function
(a + b)*
a(ab)*b
aa*bb*
a*b*
79. Which of the following strings is not generated by the following grammar? S SaSbS|
a.
b.
c.
d.
aabb
abab
aababb
aaabb
IT DEPARTMENT
GATE MATERIAL
81. Consider a language L for which there exists a Turing machine (TM), T, that accepts every
word in L and either rejects or loops for every word that is not in L. The language L is
a.
b.
c.
d.
NP hard
NP complete
recursive
recursively enumerable
I only
I and II
I and III
II and III
GATE MATERIAL
c. complementation
d. concatenation
85.Which of the following problem is undecidable?
a.
b.
c.
d.
87. R1 and R2 are regular sets. Which of the following is not true?
a. R1 R2 neet not be regular
b. * R1 is regular
c. R1 R2 is regular
d.
is regular
r(*) = r*
(r*s*)* = (r + s)*
(r + s)* = r* + s*
r*s* = r* + s*
GATE MATERIAL
d. nondeterministic TM to deterministic TM
IT DEPARTMENT
GATE MATERIAL