Question

Let PP be a regular language and QQ be a context-free language such that Q⊆PQ \subseteq P. (For example, let PP be the language represented by the regular expression p∗q∗p^* q^* and QQ be {pnqn∣n∈N}\{p^n q^n \mid n \in \mathbb{N}\}). Then which of the following is ALWAYS regular?

Choose one option
Official answer and solution
Official answer
C
From
Official GATE 2011 answer key

Solution

Analyze closure properties of regular and context-free languages under intersection, set difference, and complementation.

  1. Let PP be regular and QQ be context-free with Q⊆PQ \subseteq P.
  1. Option A: P∩Q=QP \cap Q = Q (since Q⊆PQ \subseteq P). Because QQ is not necessarily regular, P∩QP \cap Q is not always regular.
  1. Option B: P−QP - Q is the difference between a regular language and a CFL. For P=p∗q∗P = p^* q^* and Q={pnqn∣n∈N}Q = \{p^n q^n \mid n \in \mathbb{N}\}, P−Q={piqj∣i≠j}P - Q = \{p^i q^j \mid i \ne j\}, which is context-free but not regular.
  1. Option D: Σ∗−Q\Sigma^* - Q is the complement of a context-free language, which in general is not even guaranteed to be context-free, let alone regular.
  1. Option C: Σ∗−P\Sigma^* - P is the complement of the regular language PP. Regular languages are closed under complementation. Therefore, Σ∗−P\Sigma^* - P is ALWAYS regular.
Final answer

C

The answer is the one in the official GATE answer key. The solution is this site's own explanation.

Source

Paper
GATE 2011 Computer Science and Information Technology (CS)
Question
24 of 65, printed as CS Q.24
Section
Computer Science and Information Technology

Report an error in this question

GATE questions are the work of the organising institutes. This site is independent and is not affiliated with them.