Skip to content
GATEiit

GATE CSE 2024 Session 2 Q21: Match compiler phases with what they produce or do

Question

Consider the following two sets:

Set XSet Y
P. Lexical Analyzer1. Abstract Syntax Tree
Q. Syntax Analyzer2. Token
R. Intermediate Code Generator3. Parse Tree
S. Code Optimizer4. Constant Folding

Which one of the following options is the CORRECT match from Set X to Set Y?

Try it: multiple choice: exactly one correct option

Select one option
Wrong answer costs 1/3 mark in GATE.
Show answer and explanation

Answer: B (official GATE 2024 final answer key)

Concept used: Each compiler phase and the representation it produces or the transformation it applies.

First step: The lexer emits tokens and the optimizer does constant folding; decide which of parse tree and AST belongs to the parser.

Full step-by-step solution

Detailed working, common mistakes and linked mock tests will be available with a free GATEiit account. Log-in is coming soon.

Share this question

WhatsAppDownload image

Source: official GATE 2024 Session 2 CS question paper and final answer key, organised by IISc Bangalore. Question paper · Answer key