Which of the following grammars is (are) ambiguous?
(A) s → ss | asb | bsa | λ
(B) s → asbs | bsas | λ
(C) s → aAB
A → bBb
B → A | λ where λ denotes empty string
Choose the correct answer from the options given below:
Solution
The correct answer is option 4.
Key Points
A is ambiguous because λ can be generated using leftmost derivation having two different parse trees with an empty string.

B is ambiguous grammar with string abab.

C is an ambiguous grammar with string abbbb.

∴ Hence the correct answer is (A) (B) and (C).