GateAI
Lexical Analysis, Parsing and SDT

GATE CSE 2025 Set 1 · Q46

MSQ2 marksEasy

Time

Which of the following statement(s) is/are TRUE while computing FirstFirst and FollowFollow during top down parsing by a compiler?

Select all that applyOne or more correct

Pick every correct option

Solution

Step-by-step verified 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 SDT

To determine the truth value of each statement:

  1. Option A is TRUE: By definition, if A→ϵA \to \epsilon is a production in the grammar, then ϵ\epsilon is added to First(A)\text{First}(A).

  2. Option B is FALSE: The input right end marker (typically represented as \)isplacedinthe) is placed in the Follow\text{Follow}setofthestartsymbol,notits set of the start symbol, not its First\text{First}$ set.

  3. Option C is FALSE: The empty string ϵ\epsilon is never an element of any Follow\text{Follow} set.

  4. Option D is TRUE: By standard definition of Follow\text{Follow}, \(theinputrightendmarker)isplacedin (the input right end marker) is placed in Follow\text{Follow}(S),where, where S$ is the start symbol of the grammar.

Thus, statements A and D are correct.

Try the question first, then check your work.

Think the official key or this write-up is wrong?

Report error or challenge

Examiner trap

The misconception this question tests

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

Where do you stand for GATE?

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.

One GATE CSE PYQ every morning

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 in GATE CSE

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 SDT

More from GATE CSE 2025 Set 1

Share this solution

A plain-text card for WhatsApp or Telegram study groups.

GateAI solution cardGATE CSE 2025 Set 1 · Q46 · MSQ

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

Independent practice explanation verified by the GateAI team. GATE is conducted by the IITs; question text follows the official paper.