GATE Computer ScienceHardGATE CS (PYQ pattern)

Which of the following languages over {a, b, c} is NOT context-free?

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

Correct answer: B. { aⁱbʲcᵏ : i < j < k }

i < j < k needs two simultaneous comparisons on a single stack; the pumping lemma for CFLs refutes it. The 'or' versions are unions of two CFLs, and aⁿbⁿcᵐ needs only one comparison.

More Theory of Computation questions

Exams that ask this topic