Consider the languages
View worked solution
Answer: D
All four languages are context-free because we can construct either a Context-Free Grammar (CFG) or a Pushdown Automaton (PDA) for each of them:
- : This is the standard matching language. A PDA can push 's onto the stack and pop them for each . Thus, is context-free.
- : This can be written as the union of two context-free languages: . Since context-free languages are closed under union, is context-free.
- : We can easily write a CFG for this language: Since a CFG exists, is context-free.
- : Similar to , this can be expressed as the union of two context-free languages: . Thus, is context-free.
Therefore, all the given languages are context-free.
Free practice · Your answers on this page are not saved.
