0% found this document useful (0 votes)
119 views5 pages

TOC Unit III MCQ

This document contains a 21 multiple choice question quiz on topics related to formal languages and automata theory. The questions cover topics such as grammars, languages accepted by different automata models, parsing, ambiguity, pumping lemmas, decidability and more. The answers provided indicate the correct response for each question.

Uploaded by

asdf
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
119 views5 pages

TOC Unit III MCQ

This document contains a 21 multiple choice question quiz on topics related to formal languages and automata theory. The questions cover topics such as grammars, languages accepted by different automata models, parsing, ambiguity, pumping lemmas, decidability and more. The answers provided indicate the correct response for each question.

Uploaded by

asdf
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

TOC unit III MCQ

1. Grammars that can be translated to DFAs:


a.Left linear grammar
b.Right linear grammar
c.Generic grammar
d.All of these
Answer: (b).Right linear grammar

2. The language accepted by a Push down Automata:


a.Type0
b.Type1
c.Type2
d.Type3
Answer: (c).Type2

3.Recursive Descent Parsers are a type of:


a.LL parsers
b.LR parsers
c.LALR parsers
d.SLR parsers
Answer: (a).LL parsers

4. If language L={0,1}*, then the reversed language L^R =


a.{0,1}*
b.{}
c. {0}*
d.{1}*
Answer: (a).{0,1}*

5. Consider the following two languages:

L1 = {x ∣ for some y with ∣y∣ = 2^∣x∣,xy ∈ L and L is regular language}


L2 = {x ∣ for some y such that ∣x∣ = ∣y∣, xy ∈ L and L is regular language}

Which one of the following is correct?


a.Only L1 is regular language
b.Only L2 is regular language
c.Both L1 and L2 are regular languages
d.Both L1 and L2 are not regular languages
Answer: (c).Both L1 and L2 are regular languages
6. Consider R to be any regular language and L1, L2 be any two context-free languages. Which of the
following is correct?
a.L1’ is context free
b.(L1 ∪ L2)’ – R is context free
c.L1 ∩ L2 is context free
d.L1 – R is context free
Answer: (d).L1 – R is context free

7. Consider the following problems:

(i) Whether a finite state automaton halts on all inputs?


(ii) Whether a given context free language is regular?
(iii) Whether a Turing machine computes the product of two numbers?

Which one of the following is correct?


a.Only (i) and (iii) are undecidable problems
b.Only (ii) and (iii) are undecidable problems
c.Only (i) and (ii) are undecidable problems
d.(i), (ii) and (iii) are undecidable problems
Answer: (b). Only (ii) and (iii) are undecidable problems

8. Which of the following problems is decidable for recursive languages (L)?


a.Is L = ϕ?
b.Is w ∈ L, where w is a string?
c.Is L = Σ*?
d.Is L = R, where R is a given regular set?
Answer: (b). Is w ∈ L, where w is a string?

9. Consider the following grammar G:

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.

Which of the following statement(s) is/are correct?


S1: LR(1) can parse all strings that are generated using grammar G.
S2: LL(1) can parse all strings that are generated using grammar G.

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

12. Consider the following two Grammars:

G1 : S → SbS | a
G2 : S → aB | ab, A→GAB | a, B→ABb | b

Which of the following option is correct?


a.Only G1 is ambiguous
b.Only G2 is ambiguous
c.Both G1 and G2 are ambiguous
d.Both G1 and G2 are not ambiguous
Answer: (c). Both G1 and G2 are ambiguous

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

14. A bottom-up parser generates:


a.Left-most derivation in reverse
b.Right-most derivation in reverse
c.Left-most derivation
d.Right-most derivation
Answer: (b). Right-most derivation in reverse

15.Consider the following statements:

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.

Which of the following options is correct?


a. Both S1 and S2 are correct
b. Both S1 and S2 are not correct
c. Only S1 is correct
d. Only S2 is correct
Answer: (a). Both S1 and S2 are correct

16.Which of the following statements is/ are TRUE?

(a) The grammar S → SS a is ambiguous. (Where S is the start symbol)


(b) The grammar S → 0S1 | 01S | ϵ is ambiguous. (The special symbol ϵ represents the empty string)
(Where S is the start symbol)
(c) The grammar (Where S is the start symbol)
S → T/U
T → x S y | xy | ϵ
U → yT
generates a language consisting of the string yxxyy.
a.Only (a) and (b) are TRUE.
b.Only (a) and (c) are TRUE.
c.Only (b) and (c) are TRUE.
d.All of (a), (b) and (c) are TRUE.
Answer: (d). All of (a), (b) and (c) are TRUE.

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

19.The language L = {a^i b c^i | i ≥ 0} over the alphabet {a, b, c} is:


a.a regular language.
b.not a deterministic context free language but a context free language.
c.recursive and is a deterministic context free language.
d.not recursive.
Answer: (c). recursive and is a deterministic context free language.

20.Context free grammar is not closed under :


a.Concatenation
b.Complementation
c.Kleene Star
d.Union
Answer: (b).Complementation

21. Consider the following languages :

L1 = {a^m b^n | m ≠ n}
L2 = {a^m b^n | m = 2n+1}
L3 = {a^m b^n | m ≠ 2n}

Which one of the following statement is correct?


a.Only L1 and L2 are context free languages
b.Only L1 and L3 are context free languages
c.Only L2 and L3 are context free languages
d.L1, L2 and L3 are context free languages
Answer: (d). L1, L2 and L3 are context free languages

You might also like