Toc
Toc
In each of the following questions, choose the correct answer from the four choi
ces provided.
1.
The following grammar
G = (N, T, P, S)
N = {S, A, B}
T = {a, b, c}
P : S ? aSa
S ? aAa
A ? bB
B ? bB
B ? c is
a. is type 3
b. is type 2 but not type 3
c. is type 1 but not type 2
d. is type 0 but not type 1
2.
The following grammar
G = (N, T, P, S)
N = {S, A, B, C, D, E}
T = {a, b, c}
P : S ? aAB
AB ? CD
CD ? CE
C ? aC
C ? b
bE ? bc is
a. is type 3
b. is type 2 but not type
c. is type 1 but not type
d. is type 0 but not type
3.
The following grammar
G = (N, T, P, S)
N = {S, A, B, C}
T = {a, b, c}
P : S ? aS
A ? bB
B ? cC
C ? a is
a. is type 3
b. is type 2 but not type
c. is type 1 but not type
d. is type 0 but not type
4.
The following grammar
G = (N, T, P, S)
N = {S, A, B, C, D, E}
T = (a, b, c}
P : S ? ABCD
BCD ? DE
D ? aD
D ? a
E ? bE
E ? c is
3
2
1
3
2
1
a. is type 3
b. is type 2 but not type 3
10.
The following CFG is in
S ? aBB
B ? bAA
A ? a
B ? b
a. Chomsky normal form but not strong Chomsky normal form
b. Weak Chomsky normal form but not Chomsky normal form
c. Strong Chomsky normal form
d. Greibach normal form
11.
Which of the following CF language is inherently ambiguous?
a. {anbncmdm|n, m = 1}
b. {anbmcpdq|n = p or m = q, n, m, p, q = 1}
c. {anbmcpdq|n ? m ? p ? q}
d. {anbmcpdq|n ? m ? p ? q}
14.
Can a DFSA simulate a NFSA
a. No
b. Yes
c. sometimes
d. depends on NFA
16.
The concept of FSA is much used in this part of the compiler
a. lexical analysis
b. parser
c. code generation
d. code optimization
17.
The concept of grammar is much used in this part of the compiler
a. lexical analysis
b. parser
c. code generation
d. code optimization
18.
(a + b)(cd)*(a + b) denotes the following set
a. {a(cd)nb|n = 1}
b. {a(cd)na|n = 1} ? {b(cd)nb/n = 1}
c. {a(cd)na|n = 0} ? {a(cd)nb/n = 0} ? {b(cd)na/n = 0} ? {b(cd)nb/n = 0}
d. {acndnb|n = 1}
19.
baa*c denotes the set
a. {bnamcp|n, m, p = 1}
b. {banc|n = 0}
c. {banc|n = 1}
d. {w|w is a string of a, b, c}
20.
The set of all strings over the alphabet S = {a, b} (including e) is denoted by
a. (a + b)*
b. (a + b)+
c. a+b+
d. a*b*
21.
Palindromes cant be recognized by any FSA because
a. FSA cannot remember arbitrarily large amount of information
b. FSA cannot deterministically fix the midpoint
c. Even if the mid point is known an FSA cannot find whether the second half of
the string matches the first half
language L is
a. NP hard
b. NP complete
c. recursive
d. recursively enumerable
32.
Consider the following statements
I. Recursive languages are closed under complementation
II. Recursively enumerable languages are closed under union
III. Recursively enumerable languages are closed under complementation
Which of the above statement are TRUE?
a. I only
b. I and II
c. I and III
d. II and III
33.
Which of the following statement is wrong?
a. Any regular language can be generated by a context-free grammar
b. Some non-regular languages cannot be generated by any CFG
c. the intersection of a CFL and regular set is a CFL
d. All non-regular languages can be generated by CFGs.
34.
Recursively enumerable languages are not closed under
a. union
b. homomorphism
c. complementation
d. concatenation
35.
Which of the following problem is undecidable?
a. membership problem for CFL
b. membership problem for regular sets
c. membership problem for CSL
d. membership problem for type 0 languages
36.
Recursive languages are
a. a proper superset of CFL
b. always recognized by PDA
c. are also called type 0 languages
d. always recognized by FSA
37.
R1 and R2 are regular sets. Which of the following is not true?
a. R1 n R2 neet not be regular
b. S* - R1 is regular
c. R1 ? R2 is regular
d. is regular
38.
Which of the following regular expression identity is true?
a. r(*) = r*
b. (r*s*)* = (r + s)*
c. (r + s)* = r* + s*
d. r*s* = r* + s*
39.
Which one of the following statement is FALSE?
a. context-free languages are closed under union
b. context-free languages are closed under concatenation
c. context-free languages are closed under intersection
d. context-free languages are closed under Kleene closure
40.
Which of the following conversion is not possible (algorithmically)?
1) From the options given below, the pair having different expressive power is
(A) Deterministic Push Down Automata (DPDA) and Non-deterministic Push Down Auto
mata (NPDA)
(B) Deterministic Finite Automata (DFA) and Non-deterministic Finite Automata(NF
A)
(C) Single tape turning machine and multi tape turning machine.
(D) Deterministic single tape turning machine and Non-Deterministic single tape
turning machine
View Answer / Hide Answer
ANSWER: Deterministic Push Down Automata (DPDA) and Non-deterministic Push Down
Automata (NPDA)
(3) The language which is generated by the grammar S-> aSa I bSb I a I b over th
e alphabet {a, b} is the set of
(A)
(B)
(C)
(D)
(4) Two persons X and Y have been asked to show that a certain problem p is NP-c
omplete. X shows a polynomial time reduction from the 3-SAT problem to p and Y s
hows a polynomial time reduction from p to 3-SAT. From these reduction it can be
inferred that
(A)
(B)
(C)
(D)
is
is
is
is
NP-com lete
NP-hard but not NP-com lete
in NP but not NP-com lete
neither NP-hard nor in NP
(5) Out of the three roblems S, Q and R, S is an NP-com lete roblem and Q and
R are the two other roblems not known to be in NP. Which one of the following s
tatements is true if Q is olynomial time reducible to S and S is the olynomial
time reducible to R?
(A)
(B)
(C)
(D)
Q
R
Q
R
is
is
is
is
NP-com lete
NP-com lete
NP-hard
NP-hard
(6) From the o tions given below the statement, which is not necessarily true if
X1 is the recursive language and X2 and X3 are the languages that is recursivel
y enumerable but not recursive is
(A)
(B)
(C)
(D)
X2
X2
X2
X1
X1
X1
X1
X3
is
is
is
is
recursively
recursively
recursively
recursively
enumerable
enumerable
enumerable
enumerable
It
It
It
It
is
is
is
is
context free
context free
nor context free, but acce ted by a turing machine
turing machine
All
All
All
All
strings
strings
strings
strings
containing
containing
that begin
containing
at least two 1s
at least two 0s
and end with either 0s or 1s
the substring 00
roblems are
ush down
(12) Let n be the ositive integer constant and L be the language with al habet
{a}. To recognize L the minimum number of states required in a DFA will be
(A)
(B)
(C)
(D)
2k + 1
k + 1
2n + 1
n + 1
(13) Consider a stack, which is limited to 10 items. The language acce ted by a
ush- down automaton in such stack is best described as
(A)
(B)
(C)
(D)
Regular
Deterministic context free
Context free
Recursive
(14) Which one of the following statement is true if L denotes the language gene
rated by the grammar S->0S0/00?
(A)
(B)
(C)
(D)
L
L
L
L
(15) Consider the regular ex ression 0 * (10 *) which is similar to the same set
as
(A)
(B)
(C)
(D)
0 + (0 + 10) *
(0 +1) * 10 (0 + 1) *
(1 * 0) * 1*
None of the above
(16) W is any string whose length is n in {0, 1}* and L is the set of all sub-st
rings of W. The minimum number of states in a non-deterministic finite automaton
that acce ts L is
(A)
(B)
(C)
(D)
n
2n
n + 1
n - 1
(17) The DFA shown below acce ts the set of all strings over {0, 1} that
(A)
(B)
(C)
(D)
End with 00
End with 0
Begin either with 0 or 1
Contain the substring 00
Both S1
Only S2
Only S1
Neither
L
L
L
L
=
=
=
=
{s
{s
{s
{s
(0+1)*
(0+1)*
(0+1)*
(0+1)*
I
I
I
I
Lt th initial stat b A = 0 and B = 0. To tak th machin to th stat A = 0
and B = 1 with output = 1 th minimum lngth of input string rquird will b
(A)
(B)
(C)
(D)
2
7
4
3
b*ab*ab*ab*
b*a(a+b)*
b*ab*ab*
(a+b)*
(23) For th abov FSA th quivalnt minimum stat automaton has th following
numbr of stats
(A)
(B)
(C)
(D)
1
2
3
4
(24) Out of th thr dcision problms P1, P2 and P3, P1 is dcidabl and P2 is
undcidabl. Th statmnt that holds tru is
(A)
(B)
(C)
(D)
P3
P3
P3
P3
is
is
is
is
(25) G = {S->SS, S->ab, S->ba, S->?} is th contxt fr grammar whos statmnt
s ar givn blow:
a. G is ambiguous
b. G producs all strings with qual numbr of as and bs.
c. Dtrministic PDA accpts G
Which of th following statmnt is tru about G?
(A)
(B)
(C)
(D)
(26) Th minimum numbr of stats in any DFA accpting th rgular languag L =
(111+11111)* is
(A)
(B)
(C)
(D)
5
7
9
11
(27) Considr th languag L = {W I W {0, 1}*, whr 0s and 1s in W ar divisibl
by 3 and 5 rspctivly. Th minimum stat dtrministic finit automaton accpt
ing th languag L has
(A)
(B)
(C)
(D)
20 stats
5 stats
10 stats
15 stats
(28) W hav an undirctd graph G(V, E) with two problms givn blow:
Does G hve n independent set of size IVI 4?
Does G hve n independent set of size 5?
The sttement tht holds true is
(A) is NP-complete nd is in P
(29) Figure shows deterministic finite stte utomton M. Let the set of seven
it inry strings whose 1st, 4th nd the lst its re 1 is denoted y S. How m
ny strings in S is ccepted y M?
(A)
(B)
(C)
(D)
1
9
3
5
(30) Which one of the following sttement is true for regulr lnguge L over
{} whose miniml finite stte utomtion hs two sttes?
(A)
(B)
(C)
(D)
L
L
L
L
must
must
must
must
e
e
e
e
(32) Which one of the following is true for the lnguge {m n c m+n I m, n1}?
(A) It is context-free ut not regulr
(B) It is regulr
(C) It is type-0 ut not context-sensitive
(D) It is context-sensitive ut not context-free
View Answer / Hide Answer
ANSWER: It is regulr
Only P2
Only P1
Neither
Both P1
is decidle
is decidle
P1 nor P2 re decidle
nd P2 re decidle
out X, is
(A)
(B)
(C)
(D)
X
X
X
X
is
is
is
is
(35) The stte digrm descries the finite stte mchine. A is the strting st
te nd n rc lel is x/y where x stnds for 1 it input nd y stnds for 2 it
output
(A)
(B)
(C)
(D)
ANSWER: It outputs the sum of the present nd the previous its of the input
(36) Which one of the following sttement is true for the C lnguge?
(A)
(B)
(C)
(D)
It
It
It
It
is
is
is
is
regulr lnguge
context-sensitive lnguge
context-free lnguge
prsle fully only y turing mchine
(37) How mny sttes re present in the smllest finite utomton which ccepts
the lnguge {x I length of x is divisile y 3}?
(A)
(B)
(C)
(D)
5
4
3
2
(38) The lst two symols of L which is the set of ll inry strings re sme.
In the minimum stte deterministic finite stte utomton, which is ccepting L
_____, sttes re present
(A)
(B)
(C)
(D)
4
6
3
5
(r*s*)* = (r+s)*
(r+s)* = r* + s*
r*s* = r* + s*
r(*) = r*
(40) Let n e the length of chrcter string. How mny sustrings (of ll leng
n(n-1)/2
n
(n (n+1)/2) + 1
n
Set
Set
Set
Set
of
of
of
of
ll
ll
ll
ll
(42) How mny sttes re present in the minimum stte finite utomton tht reco
gnizes the lnguge represented y the regulr expression (0+1)(0+1)..N times?
(A)
(B)
(C)
(D)
n+1
n+2
n
2n
(43) Consider the stte tle of finite stte mchine tht hs input x nd s
ingle output z. The shortest input sequence to rech the finl stte C if the in
itil stte is unknown is
(A)
(B)
(C)
(D)
10
01
101
110
(44) The set tht cn e recognized y deterministic finite stte utomton is
(A) The set {1, 101, 11011, 1110111, .}
(B) The set of inry string in which the numer of 0s is sme s the numer of 1s
(C) 1, 2, 4, 82n .. written in inry
(D) 1, 2, 4, 82n .. written in unry
View Answer / Hide Answer
ANSWER: 1, 2, 4, 82n .. written in inry
.
b.
c.
d.
(00)*( +0)
(00)*
0*
0(00)*
b
c
a
a
and
and
and
and
c
d
b
c
(46) L1 = and L2 = {a} are the two languages. Out of the following four options
the one that represents L1L2* U L1* is
(A)
(B)
(C)
(D)
a*
{}
{, a}
(47) W hav th languag L = {ab, aa, baa} and th four strings givn blow:
I) abaabaaabaa
II) aaaabaaaa
III) baaaaabaaaab
IV) baaaaabaa
Th strings prsnt in L* ar
(A)
(B)
(C)
(D)
I, II and IV
I, II and III
II, III and IV
I, III and IV
ANSWER: I, II and IV
It is a
It is a
It is a
Non of
(50) Which on of th following is applicabl for contxt fr languags?
Ths
Ths
Ths
Ths
(A)
(B)
(C)
(D)
ar
ar
ar
ar
closd
closd
closd
closd
undr
undr
undr
undr
(51)
S ->
S ->
S ->
S -> a I c I
S I
I
d I
Context free
Context sensitive
Regulr
LR(k)
.
.
c.
d.
(A)
(B)
(C)
(D)
III, - IV, c - I, d - II
IV, - III, c - I, d - II
III, - I, c - IV, d - II
II, - III, c - IV, d - I
NP-hrd = NP
NP-complete P =
P=NP-complete
NP-complete=NP
or every data here length is n nd memorys sttes re defined in terms of power
of 2,
Here the totl memory cpility for ll the words = mn
Hence numer of sttes re 2mn
2:
An FSM with
Power of
nd
nd
nd
(A)
Option: D
5: Which of the folowing pirs of regulr expressions re equivlent ?
A.1 (01)* nd (10)* 1
B.x (xx) * nd (xx) * x
C.x+ nd x+x*+
D.All of these
Option: D
Explntion :
Option () nd option () re similr deriving expressions using rule :- (pq)*p
= p(qp)*
Option (c) will lso e vlid since:-
(x+x*+) will e
--->(xx*)(x*x**)
--->(xx*)(x*x*)
--->(xx*)(x*)
--->(xx*)
--->x+
So, the nswer will e ll of these (Option d)
6. An FSM cn e used to dd how mny given integers ?
A.1
B.3
C.4
D.2
Option: B
7.If two finite stte mchines re equivlent, they should hve the sme numer
of
A. sttes
B. edges
C.sttes nd edges
D. none of these
Option: D
8. For which of the following pplictions regulr expressions cn e used ?
A.Designing compilers
B.Developing text editors
C.Simulting sequentil circuits
D.All of these
Option: D
9. L = {P | p ; } is prime is
A.regulr
B.not regulr
C.ccepted y DFA
D.ccepted y PDA
Option: B
10. In n incompletely specified utomt
A.no edge should e lelled epsilon
B.from ny given stte, there cnt e ny token leding to two different sttes
C.oth () nd ()
D.strt stte my not e there
Option: D