TOC Unit III MCQ
TOC Unit III MCQ
S→A∣B
A→a∣c
B→b∣c
where {S, A, B} is the set of non-terminals, {a, b, c,} is the set of terminals.
a.Only S1
b.Only S2
c.Both S1 and S2
d.Neither S1 nor S2
Answer: (d). Neither S1 nor S2
10. The grammar S → (S) ∣ SS ∣ ϵ is not suitable for predictive parsing because the grammar is
a.Right recursive
b.Left recursive
c.Ambiguous
d.An operator grammar
Answer: (c). Ambiguous
11. To obtain a string of n Terminals from a given Chomsky normal form grammar, the number of
productions to be used is:
a.2n−1
b.2n
c.n+1
d.n^2
Answer: (a).2n−1
G1 : S → SbS | a
G2 : S → aB | ab, A→GAB | a, B→ABb | b
13.The set A={ 0^n 1^n 2^n | n=1, 2, 3, ......... } is an example of a grammar that is:
a.Context sensitive
b.Context free
c.Regular
d.None of the above
Answer: (a). Context sensitive
S1 : There exists no algorithm for deciding if any two Turing machines M1 and M2 accept the same
language.
S2 : The problem of determining whether a Turing machine halts on any input is undecidable.
17. Pumping lemma for regular language is generally used for proving:
a.whether two given regular expressions are equivalent
b.a given grammar is ambiguous
c.a given grammar is regular
d.a given grammar is not regular
Answer: (a). whether two given regular expressions are equivalent
18.Which of the following problems is undecidable?
a.To determine if two finite automata are equivalent
b.Membership problem for context free grammar
c.Finiteness problem for finite automata
d.Ambiguity problem for context free grammar
Answer: (d). Ambiguity problem for context free grammar
L1 = {a^m b^n | m ≠ n}
L2 = {a^m b^n | m = 2n+1}
L3 = {a^m b^n | m ≠ 2n}