GATE | Sudo GATE 2020 Mock II (10 January 2019) | Question 43

Let G1 and G2 be two grammars such that:
G1:

S →AS | ε
A → A1 | 0A1 | 01 

G2:

S → AB | aaB
A →  a | Aa
B → b 

Which of the following statement is correct about the following statements:
(A) Only G1 is Ambiguous grammar.
(B) Only G2 is Ambiguous grammar.
(C) Both G1 and G2 are Ambiguous grammar.
(D) None of the above is true.


Answer: (C)

Explanation: String 00111 can be generated in two ways in grammar G1, similarly you can find string for G2 such that it have multiple leftmost derivations from the start symbol.



Option (C) is correct.

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.