# GATE | Gate IT 2008 | Question 32

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
(A) {0n 102n | n ≥ 1}
(B) {0i 10j 10k | i, j, k ≥ 0} ∪ {0n 102n | n ≥ l}
(C) {0i 10j | i, j ≥ 0} ∪ {0n 102n | n ≥ l}
(D) The set of all strings over {0, 1} containing at least two 0’s
(E) None of the above

Explanation:

A− > 0A|A0|1 This production rule individually produces a CFL of the form {0i 10j |i, j ≥ 0}
B− > 0B00|1 This production rule individually produces a CFL of the form {0n102n |n ≥ 0}
S− > AA|B This production rule concatenates A’s CFL with itself and unions it with B’s CFL.
Hence, CFL accepted by the given CFG will be {0n102n|n ≥ 0} ∪ {0i 10j 10k |i, j, k ≥ 0}
According to our derivation, as none of the given CFL matches to our derived CFL, correct option

should be (E) None of the above.

This solution is contributed by vineet purswani.

Quiz of this Question

My Personal Notes arrow_drop_up
Article Tags :

Be the First to upvote.

Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.