Which of the following statement(s) is/are TRUE while computing First and Follow during top down parsing by a compiler?
Topic-wise GATE CS PYQs with verified steps
GATE CSE 2025 Set 1 · Q46
Time
Select all that applyOne or more correct
Solution
Official answer: A) For a production A → , will be added to First(A).; D) If there is any input right end marker, it will be added to Follow(S), where S is the start symbol.
Lexical Analysis, Parsing and SDTTo determine the truth value of each statement:
Option A is TRUE: By definition, if is a production in the grammar, then is added to .
Option B is FALSE: The input right end marker (typically represented as \$ set.
Option C is FALSE: The empty string is never an element of any set.
Option D is TRUE: By standard definition of , \(S)S$ is the start symbol of the grammar.
Thus, statements A and D are correct.
Try the question first, then check your work.
Examiner trap
Recall the standard rules for computing and : can never be in a set, and the end-marker \(S)$.
This Lexical Analysis, Parsing and SDT previous year question is Q46 of the GATE CSE 2025 Set 1 paper. Find more GATE CSE PYQs on Lexical Analysis, Parsing and SDT in Compiler Design, or browse all GATE CSE PYQs.
Free diagnostic
Take the 20-minute diagnostic: the 3 topics that cost you the most marks, and a rank range. Or sit 5 related Lexical Analysis, Parsing and SDT PYQs now with no account.
An official question by email at 7 AM IST, with a link to its verified solution. Unsubscribe in one click.
Lexical Analysis, Parsing and SDT has 14 GATE CSE PYQs across 12 papers from 2011 to 2025. This is the only 2-mark MSQ among them, and it is the only one in GATE CSE 2025 Set 1.
How GATE tests Lexical Analysis, Parsing and SDTIndependent practice explanation verified by the GateAI team. GATE is conducted by the IITs; question text follows the official paper.