GATE Computer ScienceModerateGATE CSE · NIELIT

Which of the following languages over {a, b} is context-free but not regular?

  1. A. { a^n b^n c^n : n ≥ 0 }
  2. B. { w wᴿ : w ∈ {a, b}* }
  3. C. { a^n b^m : n, m ≥ 0 }
  4. D. { w w : w ∈ {a, b}* }

Correct answer: B. { w wᴿ : w ∈ {a, b}* }

Even-length palindromes need one stack; a^n b^n c^n and ww are not context-free; a*b* is regular.

More Theory of Computation questions

Exams that ask this topic