GATE CSE 2024 Session 2 Q21: Match compiler phases with what they produce or do
- Compiler Design
- 1 mark
- MCQ
- −1/3 if wrong
Question
Consider the following two sets:
| Set X | Set Y |
|---|---|
| P. Lexical Analyzer | 1. Abstract Syntax Tree |
| Q. Syntax Analyzer | 2. Token |
| R. Intermediate Code Generator | 3. Parse Tree |
| S. Code Optimizer | 4. 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
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
Source: official GATE 2024 Session 2 CS question paper and final answer key, organised by IISc Bangalore. Question paper · Answer key
More Compiler Design PYQs
- 2026 Session 1 · Q27Classify errors in three C string declarations
- 2026 Session 1 · Q28True statements about LL(1) parsing
- 2026 Session 1 · Q42Redundant (common) subexpressions in blocks B4 and B5 of a CFG
- 2026 Session 1 · Q53Compare two SDDs for type declarations
- 2026 Session 2 · Q35Count tokens produced by a lexer for a given string
- 2026 Session 2 · Q41Shift-reduce conflicts in the LR(0) table of a grammar