The GATE Grind

GATE 2011 CS (CS1) – Question 34

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

P is regular and Q is context-free with Q⊆P, e.g. P=p*q* and Q={pⁿqⁿ:n∈N}. Which is always regular?

  1. $P\cap Q$
  2. $P-Q$
  3. $\Sigma^*-P$
  4. $\Sigma^*-Q$

Practise this question in The GATE Grind →

Show answer and explanation

Correct answer: (C) $\Sigma^*-P$

Explanation

Regular languages are closed under complement, so Σ*−P is always regular, C. P∩Q equals Q under the subset premise and can be nonregular. Removing a nonregular CFL from P, or complementing that CFL, does not guarantee regularity.

More Regular and Context-Free Languages, Pumping Lemma questions

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