Viral News, Entertaining Stories, Videos, Life Hacks, Tech & much more.

THEORY of COMPUTATION Multiple Choice Questions and Answers (40)

Theory of Computation Questions and Answers » 40 TOP THEORY of COMPUTATION Multiple Choice Questions and Answers

100 TOP THEORY of COMPUTATION Multiple Choice Questions and Answers

THEORY of COMPUTATION Multiple Choice Questions and Answers :-

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 3
c. is type 1 but not type 2
d. is type 0 but not type 1

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 3
c. is type 1 but not type 2
d. is type 0 but not type 1

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

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

5. Consider the following CFG
S ? aB S ? bA
B ? b A ? a
B ? bS A ? aS
B ? aBB A ? bAA

Consider the following derivation
S ? aB
? aaBB
? aaBb
? aabSb
? aabbAb
? aabbab

This derivation is
a. a leftmost derivation
b. a rightmost derivation
c. both leftmost and rightmost derivation
d. neither leftmost nor rightmost derivation
6.
Consider the following language
L = {anbncndn|n = 1}
L is
a. CFL but not regular
b. CSL but not CFL
c. regular
d. type 0 language but not type 1
7.
Consider the following language
L = {anbn|n = 1}
L is
a. CFL but not regular
b. CSL but not CFL
c. regular
d. type 0 language but not type 1
8.
Consider the following language
L = {anbmcpdq|n, m, p, q = 1}
L is
a. CFL but not regular
b. CSL but not CFL
c. regular
d. type 0 language but not type 1
9.
The following CFG is in
S ? AB
B ? CD
B ? AD
B ? b
D ? AD
D ? d
A ? a
C ? a
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
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*

THEORY of COMPUTATION Multiple Choice Questions and Answers :-

21. Palindromes can’t 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
d. all of the above
22.
Let S = {a, b, c, d, e}. The number of strings in S* of length 4 such that no symbol is used more than once in a string is
a. 360
b. 120
c. 35d. 36
23.
Which of the following denotes Chomskian hiearchy?
a. REG ? CFL ? CSL ? type0
b. CFL ? REG ? type0 ? CSL
c. CSL ? type0 ? REG ? CFL
d. CSL ? CFL ? REG ? type0
24.
A language L is accepted by a FSA iff it is
a. CFL
b. CSL
c. recursive
d. regular
25.
Which of the following regular expressions denotes a language comprising of all possible strings over S = {a, b} of length n where n is a multiple of 3.
a. (a + b + aa + bb + aba + bba)*
b. (aaa + bbb)*
c. ((a + b)(a + b)(a + b))*
d. (aaa + ab + a) + (bbb + bb + a)
26.
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. aaa
b. aba
c. ababad. aa
27.
Which of the following is not primitive recursive but partially recursive?
a. McCarthy’s function
b. Riemann function
c. Ackermann’s function
d. Bounded function
28.
Consider the following right-linear grammar G = (N, T, P, S) N = {S}
P : S ? aS|aA T = {a, b}
A ? bA|b

Which of the following regular expression denotes L(G)?
a. (a + b)*
b. a(ab)*b
c. aa*bb*
d. a*b*
29.
Which of the following strings is not generated by the following grammar? S ? SaSbS|e
a. aabb
b. abab
c. aababb
d. aaabb

31.
Consider a language L for which there exists a Turing machine ™, 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. 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)?
a. regular grammar to context-free grammar
b. nondeterministic FSA to deterministic FSA
c. nondeterministic PDA to deterministic PDA
d. nondeterministic TM to deterministic TM
Answers ::
1.b 2.c 3.a 4.d 5.d 6.b 7.a 8.c 9.c 10.d 11.b 12.a 13.b 14.b 15.b 16.a 17.b18.c 19.c 20.a 21.d 22.b 23.a 24.d 25.c 26.c 27.c 28.c 29.d 30.c 31.d 32.b 33.d 34.c 35.d 36.a 37.a 38.b 39.c 40.c

Facebook Comments

Written by Navdeep

Entrepreneur, Blogger,
Thinker | Programmer
love the WEB.
~~Proud Earthling~~

Back to Top
Skip to toolbar