GATE Computer ScienceHardGATE CS (PYQ pattern)

Which of the following languages is inherently ambiguous?

  1. A. { aⁿbⁿcᵐ : n, m ≥ 0 }
  2. B. { w wᴿ : w ∈ {a, b}* }
  3. C. { aⁱbʲcᵏ : i = j or j = k }
  4. D. { aⁱbʲ : i = j or i ≠ j }

Correct answer: C. { aⁱbʲcᵏ : i = j or j = k }

Strings with i = j = k have two essentially different derivations in any grammar for the union of the two CFLs; this is the standard inherently ambiguous language. The others have unambiguous grammars.

More Theory of Computation questions

Exams that ask this topic