Match the following:
Topic-wise GATE CS PYQs with verified steps
GATE CSE 2015 Set 2 · Q19
Time

Select one answerSingle correct
Solution
Official answer: C) P-2, Q-4, R-1, S-3
Lexical Analysis, Parsing and SDTLet us match each concept in the left column with its corresponding phase/technique in the right column:
P. Lexical analysis 2. DFA minimization: Lexical analyzers use Deterministic Finite Automata (DFAs) to recognize tokens. Minimizing DFAs produces efficient tokenizers.
Q. Parsing 4. Production tree: Parsing involves constructing a parse tree (or production tree) from a grammar to verify the syntax of the input string.
R. Register allocation 1. Graph coloring: Register allocation is mapped to the graph coloring problem (an NP-complete problem) on an interference graph to assign registers to variables.
S. Expression evaluation 3. Post-order traversal: Evaluating an expression represented as an abstract syntax tree / expression tree is done using post-order traversal (evaluating sub-expressions before applying the operator).
Thus, the correct matching is P-2, Q-4, R-1, S-3, which corresponds to option (C).
Try the question first, then check your work.
Examiner trap
Think about which technique is famously mapped to an interference graph during code generation, and how an expression tree is evaluated from its leaves upwards.
This Lexical Analysis, Parsing and SDT previous year question is Q19 of the GATE CSE 2015 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
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. 9 of them are 1-mark MCQs like this one, and it is the only one in GATE CSE 2015 Set 2.
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.