Question
Consider the following context-free grammar , where , , and are the variables (non-terminals), and are the terminal symbols, is the start variable, and the rules of are described as:
Which ONE of the languages is accepted by ?
Official answer and solution
- Official answer
- A
- From
- Official GATE 2025 answer key
Solution
Find the languages generated by non-terminals and and take the union of the two productions of .
- Non-terminal generates all non-empty strings of 's: .
- Non-terminal generates all non-empty strings of 's: .
- Substituting into gives:
Final answer
Option (A)
The answer is the one in the official GATE answer key. The solution is this site's own explanation.
Source
- Paper
- GATE 2025 Computer Science and Information Technology - Session 1 (CS1)
- Question
- 19 of 65
- 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.