GATE CSE 2021 Set 1 Q14: Procedure calls and returns vs activation tree traversals
- Compiler Design
- 1 mark
- MCQ
- −1/3 if wrong
Question
Consider the following statements.
: The sequence of procedure calls corresponds to a preorder traversal of the activation tree.
: The sequence of procedure returns corresponds to a postorder traversal of the activation tree.
Which one of the following options is correct?
Try it: multiple choice: exactly one correct option
Show answer and explanation
Answer: C (official GATE 2021 final answer key)
Concept used: In an activation tree a node is entered before its children and returns only after all of them return.
First step: A call happens when its node is first visited (preorder); a return happens after all callees return (postorder).
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 2021 Set 1 CS question paper and final answer key, organised by IIT Bombay. 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