GateAI
Lexical Analysis, Parsing and SDT

GATE CSE 2017 Set 2 · Q5

MCQ1 markEasy

Time

Match the following according to input (from the left column) to the compiler phase (in the right column) that processes it:

GATE CSE 2017 Set 2 Q5 diagram

Select one answerSingle correct

Pick an option to check

Solution

Step-by-step verified solution

Official answer: C) P → (iii), Q → (iv), R → (i), S → (ii)

Lexical Analysis, Parsing and SDT

The inputs to the compiler phases are matched as follows:

  1. (Q) Character stream is the input to the (iv) Lexical analyzer, which converts characters into a stream of tokens.

  2. (S) Token stream is the input to the (ii) Syntax analyzer (parser), which constructs a parse/syntax tree.

  3. (P) Syntax tree is the input to the (iii) Semantic analyzer, which performs semantic checks and type checking.

  4. (R) Intermediate representation is the input to the (i) Code generator, which translates the intermediate representation into target machine code.

Therefore, the correct mapping is:

  • P→(iii)\text{P} \rightarrow \text{(iii)}

  • Q→(iv)\text{Q} \rightarrow \text{(iv)}

  • R→(i)\text{R} \rightarrow \text{(i)}

  • S→(ii)\text{S} \rightarrow \text{(ii)}

This corresponds to option (C).

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 Q5 of the GATE CSE 2017 Set 2 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 GATE CSE 2017 Set 2 has 2.

How GATE tests Lexical Analysis, Parsing and SDT

More from GATE CSE 2017 Set 2

Share this solution

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

GateAI solution cardGATE CSE 2017 Set 2 · Q5 · MCQ

Match the following according to input (from the left column) to the compiler phase (in the right column) that processes it:

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.