GateAI
Lexical Analysis, Parsing and SDT

GATE CSE 2015 Set 1 · Q13

MCQ1 markMedium

Time

Which one of the following is TRUE at any valid state in shift-reduce parsing?

Select one answerSingle correct

Pick an option to check

Solution

Step-by-step verified solution

Official answer: C) The stack contains only a set of viable prefixes

Lexical Analysis, Parsing and SDT

In shift-reduce parsing (bottom-up parsing), a viable prefix is a prefix of a right-sentential form that can appear on the stack of a shift-reduce parser without extending past the right end of the handle [18].

  • At any valid configuration of a shift-reduce parser, the string of grammar symbols held in the parsing stack must form a viable prefix of some right-sentential form [18].

  • Hence, the parsing stack always contains only a viable prefix (or prefixes) of the grammar at every valid state [18].

Therefore, option C is the correct statement [18].

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 Q13 of the GATE CSE 2015 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. 9 of them are 1-mark MCQs like this one, and it is the only one in GATE CSE 2015 Set 1.

How GATE tests Lexical Analysis, Parsing and SDT

More from GATE CSE 2015 Set 1

Share this solution

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

GateAI solution cardGATE CSE 2015 Set 1 · Q13 · MCQ

Which one of the following is TRUE at any valid state in shift-reduce parsing?

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.