Question
Which one of the following languages over is NOT context-free?
Official answer and solution
- Official answer
- C
- From
- Official GATE 2019 answer key
Solution
Analyze each language's pushdown automaton compatibility or use the pumping lemma for CFLs.
Let us examine the languages:
- Option A: is the standard even palindrome language, which is generated by and accepted by an NPDA. (Context-free)
- Option B: is generated by where . The PDA pushes , then matches , and finally matches against the remaining stack. (Context-free)
- Option C: . In any string of this language, the palindrome matching of with is interleaved with the count matching of with . A single stack cannot verify that matches while simultaneously preserving the count of 's to match against appearing later. By the Pumping Lemma for CFLs, choosing shows that this language is NOT context-free.
- Option D: . Each of these three languages is context-free, and context-free languages are closed under finite union. (Context-free)
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 2019 Computer Science and Information Technology (CS)
- Question
- 41 of 65, printed as CS Q.31
- 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.