The GATE Grind

GATE 2017 CS (CS2) – Question 50

Theory of Computation · Regular and Context-Free Languages, Pumping Lemma · 2 marks · Multiple choice

L₁={aᵖ:p prime}, $L_2=\{a^nb^mc^{2m}:n,m\ge0\}$, $L_3=\{a^nb^nc^{2n}:n\ge0\}$, L₄={aⁿbⁿ:n≥1}. Which hold? I: L₁ context-free but not regular. II: L₂ not context-free. III: L₃ not context-free but recursive. IV: L₄ deterministic context-free.

  1. I, II and IV only
  2. II and III only
  3. I and IV only
  4. III and IV only

Practise this question in The GATE Grind →

Show answer and explanation

Correct answer: (D) III and IV only

Explanation

Every unary context-free language is regular, whereas prime-length unary strings are nonregular, so I is false. L₂ is context-free: ignore the a-prefix and match one b to two c’s, so II is false. L₃ is decidable by counting but is non-CFL via inverse homomorphism to aⁿbⁿcⁿ, proving III. A deterministic PDA matches L₄’s a’s to b’s, proving IV. Thus D.

More Regular and Context-Free Languages, Pumping Lemma questions

All Regular and Context-Free Languages, Pumping Lemma questions →