GATE CSE 2024 Session 1 Q38: Complete a grammar from its FIRST and FOLLOW sets
- Compiler Design
- 2 marks
- MCQ
- −2/3 if wrong
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?
Try it: multiple choice: exactly one correct option
Show answer and explanation
Answer: A (official GATE 2024 final answer key)
Concept used: FIRST and FOLLOW sets constrain which symbols can start or follow each non-terminal.
First step: and force (2) to be ; then use .
Full step-by-step solution
Detailed working, common mistakes and linked mock tests will be available with a free GATEiit account. Log-in is coming soon.
Share this question
Source: official GATE 2024 Session 1 CS question paper and final answer key, organised by IISc Bangalore. Question paper · Answer key
More Compiler Design PYQs
- 2026 Session 1 · Q27Classify errors in three C string declarations
- 2026 Session 1 · Q28True statements about LL(1) parsing
- 2026 Session 1 · Q42Redundant (common) subexpressions in blocks B4 and B5 of a CFG
- 2026 Session 1 · Q53Compare two SDDs for type declarations
- 2026 Session 2 · Q35Count tokens produced by a lexer for a given string
- 2026 Session 2 · Q41Shift-reduce conflicts in the LR(0) table of a grammar