GATE | GATE CS Mock 2018 | Question 53

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}

(A) Only L1 and L2
(B) Only L1 and L3
(C) Only L2 and L3
(D) All L1, L2, and L3


Answer: (D)

Explanation: All given languages are inherently ambiguous and generates more than one parse tree for some string(s).

Option (D) 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.