The GATE Grind

GATE 2017 CS (CS2) – Question 14

Theory of Computation · Regular and Context-Free Languages, Pumping Lemma · 1 mark · Multiple choice

L₁,L₂ are context-free and R is regular. Which are correct? I: L₁∪L₂ is context-free. II: $\overline{L_1}$ is context-free. III: L₁−R is context-free. IV: L₁∩L₂ is context-free.

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

Practise this question in The GATE Grind →

Show answer and explanation

Correct answer: (B) I and III only

Explanation

CFLs are closed under union, proving I. Also $L_1-R=L_1\cap\overline R$; regular languages are complement-closed and intersecting a CFL with a regular language preserves context-freeness, proving III. CFLs are not generally closed under complement or intersection, so II and IV fail. Thus B.

More Regular and Context-Free Languages, Pumping Lemma questions

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