Question
Let be a regular language and be a context-free language such that . (For example, let be the language represented by the regular expression and be ). Then which of the following is ALWAYS regular?
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.
- Let be regular and be context-free with .
- Option A: (since ). Because is not necessarily regular, is not always regular.
- Option B: is the difference between a regular language and a CFL. For and , , which is context-free but not regular.
- Option D: is the complement of a context-free language, which in general is not even guaranteed to be context-free, let alone regular.
- Option C: is the complement of the regular language . Regular languages are closed under complementation. Therefore, 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.