Question
Consider the following grammar , with as the start symbol. The grammar has three incomplete productions denoted by (1), (2), and (3).
The set of terminals is . The FIRST and FOLLOW sets of the different non-terminals are as follows.
Which one of the following options CORRECTLY fills in the incomplete productions?
Official answer and solution
- Official answer
- A
- From
- Official GATE 2024 answer key
Solution
Use the given FIRST and FOLLOW sets to deduce each missing production one by one.
- Deduce (2) from :
Since , must have the production . This eliminates options (C) and (D). - Deduce (1) from and :
The production only contributes to , so production (1) must contribute both and to . With , since , we get:which yields and also places (whereas would only give and would place ). - Verify (3) :
This gives and adds to , matching .
Thus Option (A) is correct.
Option (A)
The answer is the one in the official GATE answer key. The solution is this site's own explanation.
Source
- Paper
- GATE 2024 Computer Science and Information Technology - Set 1 (CS1)
- Question
- 38 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.