GATE 2017 CS (CS2) – Question 50
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.
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
- GATE 2013 CS (CS1) Q42
- GATE 2011 CS (CS1) Q34
- GATE 2011 CS (CS1) Q36
- GATE 2015 CS (CS2) Q46
- GATE 2025 CS (CS1) Q44
- GATE 2025 CS (CS1) Q45
All Regular and Context-Free Languages, Pumping Lemma questions →