Menu

Context Free Grammars Questions

MCQ
11.
Consider a CFG with the following productions. S ? AA | B A ? 0A | A0 | 1 B ? 0B00 | 1 S is the start symbol, A and B are non-terminals and 0 and 1 are the terminals. The language generated by this grammar is
forum Discussion
MCQ
12.
A CFG G is given with the following productions where S is the start symbol, A is a non-terminal and a and b are terminals.
S?aS?A
A?aAb?bAa??
Which of the following strings is generated by the grammar above?
forum Discussion
MCQ
13.
A CFG G is given with the following productions where S is the start symbol, A is a non-terminal and a and b are terminals.
S?aS?A
A?aAb?bAa??
For the correct answer in Q75, how many steps are required to derive the string and how many parse trees are there?
forum Discussion
MCQ
14.
Consider 2 scenarios:
C1: For DFA (?, ?, ?, qo, F),
         if F = ?, then L = ?*
C2: For NFA (?, ?, ?, qo, F),
         if F = ?, then L = ?*
Where F = Final states set
? = Total states set
Choose the correct option ?
forum Discussion
MCQ
15.
Let G be the CFG, l be the number of left most derivations, r be the number of right most derivations and P be the number of parse trees. Assume l , r and P are computed for a particular string. For a given CFG
forum Discussion
MCQ
16.
Context free languages are closed under-
forum Discussion
MCQ
17.
Let G be a context-free grammar where G = ( { S, A, B, C}, { a,b, d}, P, S ) with the productions in P given below.
S ? ABAC
A ? aA ? ?
B ? bB ? ?
C ? d
 (? denotes null string). Transform the grammar G to an equivalent context-free grammar G' that has no ? productions and no unit productions. (A unit production is of the form x ? y, and x and y are non terminals.)
forum Discussion
MCQ
18.
Consider the following context-free grammar over the alphabet ? = {a, b} with S as the start symbol:
S ? AT 
A ? aAa | bAb | #T 
T ? aT | bT | ? 
Which of the following represents the language generated by the above grammar?
forum Discussion
MCQ
19.
Consider the following context free languages:
L1 = {0^i 1^j 2^k | i+j = k}
L2 = {0^i 1^j 2^k | i = j or j = k}
L3 = {0^i 1^j  | i = 2j+1}
 Which of the following option is true?
forum Discussion
MCQ
20.
Which of the following language(s) generates more than one parse tree for a string ?

L1 = {a^nb^mc^md^n ? {a, b, c, d}* | n, m ? 0} 
      ? {a^nb^nc^md^m ? {a, b, c, d}* | n, m ? 0} 

L2 = {a^nb^mc^m ? {a, b, c}* | n, m ? 0} 
      ? {a^nb^nc^m ? {a, b, c}* | n, m ? 0}

L3 = {a^nb^mc^p ? {a, b, c}* | n ? m; n, m ? 0} 
      ? {a^nb^mc^p ? {a, b, c}* | m ? p; n, m ? 0}
forum Discussion