GATE Computer ScienceVery hardGATE CS (PYQ pattern)

Which of the following statements are correct? I. Every context-free language over a one-letter alphabet is regular. II. { a^(2ⁿ) : n ≥ 0 } is context-sensitive but not context-free. III. If L ⊆ {a, b}* is context-free, then { a^|w| : w ∈ L } is regular. IV. Every context-sensitive language over a one-letter alphabet is regular.

  1. A. I and II only
  2. B. I and III only
  3. C. I, II, III and IV
  4. D. I, II and III only

Correct answer: D. I, II and III only

I is Parikh's theorem specialised to one letter (semilinear = eventually periodic). II: a^(2ⁿ) is not regular, so by I it is not context-free, yet an LBA can decide it. III: the image under h(a) = h(b) = a of a CFL is a unary CFL, hence regular by I. IV is false: II is a counterexample.

More Theory of Computation questions

Exams that ask this topic