Saturday 26 January 2013

TOC MCQ One

1.The following grammar
G = (N, T, P, S)
N = {S, A, B}
T = {a, b, c}
P : SaSa
SaAa
AbB
BbB
Bc is
  1. is type 3
  2. is type 2 but not type 3
  3. is type 1 but not type 2
  4. 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 : SaAB
ABCD
CDCE
CaC
Cb
bEbc is

  1. is type 3
  2. is type 2 but not type 3
  3. is type 1 but not type 2
  4. 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 : SaS
AbB
BcC
Ca is
  1. is type 3
  2. is type 2 but not type 3
  3. is type 1 but not type 2
  4. 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 : SABCD
BCDDE
DaD
Da
EbE
Ec is

  1. is type 3
  2. is type 2 but not type 3
  3. is type 1 but not type 2
  4. is type 0 but not type 1
5.Consider the following CFG
SaBSbA
BbAa
BbSAaS
BaBBAbAA

Consider the following derivation
SaB
aaBB
aaBb
aabSb
aabbAb
aabbab

This derivation is
  1. a leftmost derivation
  2. a rightmost derivation
  3. both leftmost and rightmost derivation
  4. neither leftmost nor rightmost derivation
6.Consider the following language
L = {anbncndn|n ≥ 1}
L is
  1. CFL but not regular
  2. CSL but not CFL
  3. regular
  4. type 0 language but not type 1
7.Consider the following language
L = {anbn|n ≥ 1}
L is
  1. CFL but not regular
  2. CSL but not CFL
  3. regular
  4. type 0 language but not type 1
8.Consider the following language
L = {anbmcpdq|n, m, p, q ≥ 1}
L is
  1. CFL but not regular
  2. CSL but not CFL
  3. regular
  4. type 0 language but not type 1
9.The following CFG is in
SAB
BCD
BAD
Bb
DAD
Dd
Aa
Ca
  1. Chomsky normal form but not strong Chomsky normal form
  2. Weak Chomsky normal form but not Chomsky normal form
  3. Strong Chomsky normal form
  4. Greibach normal form
10.The following CFG is in
SaBB
BbAA
Aa
Bb
  1. Chomsky normal form but not strong Chomsky normal form
  2. Weak Chomsky normal form but not Chomsky normal form
  3. Strong Chomsky normal form
  4. Greibach normal form
11.Which of the following CF language is inherently ambiguous?
  1. {anbncmdm|n, m ≥ 1}
  2. {anbmcpdq|n = p or m = q, n, m, p, q ≥ 1}
  3. {anbmcpdq|nmpq}
  4. {anbmcpdq|nmpq}
12.Which string is not accepted by the following FSA?
  1. 00111
  2. 01010
  3. 00110
  4. 11010
13.Which string is accepted by the following FSA?
  1. 00111
  2. 11011
  3. 01101
  4. 0101
14.Can a DFSA simulate a NFSA
  1. No
  2. Yes
  3. sometimes
  4. depends on NFA
15.Which of the following is true for an arbitrary language L.
  1. L* = L+ ∪ {λ}
  2. L* = L+
  3. L* = L+ − {λ}
16.The concept of FSA is much used in this part of the compiler
  1. lexical analysis
  2. parser
  3. code generation
  4. code optimization
17.The concept of grammar is much used in this part of the compiler
  1. lexical analysis
  2. parser
  3. code generation
  4. code optimization
18.(a + b)(cd)*(a + b) denotes the following set
  1. {a(cd)nb|n ≥ 1}
  2. {a(cd)na|n ≥ 1} ∪ {b(cd)nb/n ≥ 1}
  3. {a(cd)na|n ≥ 0} ∪ {a(cd)nb/n ≥ 0} ∪ {b(cd)na/n ≥ 0} ∪ {b(cd)nb/n ≥ 0}
  4. {acndnb|n ≥ 1}
19.baa*c denotes the set
  1. {bnamcp|n, m, p ≥ 1}
  2. {banc|n ≥ 0}
  3. {banc|n ≥ 1}
  4. {w|w is a string of a, b, c}
20.The set of all strings over the alphabet Σ = {a, b} (including ε) is denoted by
  1. (a + b)*
  2. (a + b)+
  3. a+b+
  4. a*b*
21.Palindromes can’t be recognized by any FSA because
  1. FSA cannot remember arbitrarily large amount of information
  2. FSA cannot deterministically fix the midpoint
  3. Even if the mid point is known an FSA cannot find whether the second half of the string matches the first half
  4. all of the above
22.Let Σ = {a, b, c, d, e}. The number of strings in Σ* of length 4 such that no symbol is used more than once in a string is
  1. 360
  2. 120
  3. 35
  4. 36
23.Which of the following denotes Chomskian hiearchy?
  1. REGCFLCSLtype0
  2. CFLREGtype0 ⊂ CSL
  3. CSLtype0 ⊂ REGCFL
  4. CSLCFLREGtype0
24.A language L is accepted by a FSA iff it is
  1. CFL
  2. CSL
  3. recursive
  4. regular
25.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.
  1. (a + b + aa + bb + aba + bba)*
  2. (aaa + bbb)*
  3. ((a + b)(a + b)(a + b))*
  4. (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.
  1. aaa
  2. aba
  3. ababa
  4. aa
27.Which of the following is not primitive recursive but partially recursive?
  1. McCarthy’s function
  2. Riemann function
  3. Ackermann’s function
  4. Bounded function
28.Consider the following right-linear grammar G = (N, T, P, S) N = {S}
P : SaS|aAT = {a, b}
AbA|b

Which of the following regular expression denotes L(G)?
  1. (a + b)*
  2. a(ab)*b
  3. aa*bb*
  4. a*b*
29.Which of the following strings is not generated by the following grammar? SSaSbS|ε
  1. aabb
  2. abab
  3. aababb
  4. aaabb
30.Consider the following NFSA
The automaton accepts
  1. all words of the form {(ab)na|n ≥ 1}
  2. all words that end with a and ε
  3. all words that end with a and not ε
  4. all words containing substring ba
31.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
  1. NP hard
  2. NP complete
  3. recursive
  4. recursively enumerable
32.Consider the following statements
  1. Recursive languages are closed under complementation
  2. Recursively enumerable languages are closed under union
  3. Recursively enumerable languages are closed under complementation
Which of the above statement are TRUE?
  1. I only
  2. I and II
  3. I and III
  4. II and III
33.Which of the following statement is wrong?
  1. Any regular language can be generated by a context-free grammar
  2. Some non-regular languages cannot be generated by any CFG
  3. the intersection of a CFL and regular set is a CFL
  4. All non-regular languages can be generated by CFGs.
34.Recursively enumerable languages are not closed under
  1. union
  2. homomorphism
  3. complementation
  4. concatenation
35.Which of the following problem is undecidable?
  1. membership problem for CFL
  2. membership problem for regular sets
  3. membership problem for CSL
  4. membership problem for type 0 languages
36.Recursive languages are
  1. a proper superset of CFL
  2. always recognized by PDA
  3. are also called type 0 languages
  4. always recognized by FSA
37.R1 and R2 are regular sets. Which of the following is not true?
  1. R1R2 neet not be regular
  2. Σ* − R1 is regular
  3. R1 ∪ R2 is regular
  4. is regular
38.Which of the following regular expression identity is true?
  1. r(*) = r*
  2. (r*s*)* = (r + s)*
  3. (r + s)* = r* + s*
  4. r*s* = r* + s*
39.Which one of the following statement is FALSE?
  1. context-free languages are closed under union
  2. context-free languages are closed under concatenation
  3. context-free languages are closed under intersection
  4. context-free languages are closed under Kleene closure
40.Which of the following conversion is not possible (algorithmically)?
  1. regular grammar to context-free grammar
  2. nondeterministic FSA to deterministic FSA
  3. nondeterministic PDA to deterministic PDA
  4. 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.b
    18.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

No comments:

Post a Comment