GATE CS 2023 | Question 36
Compiler Design › Runtime Environment · MCQ · 2 marks · Answer: A
- Question 36Compiler Designmcq2 marksFor the given program (main calls f1(); f2(2); f3();, where f2 calls f3() then recurses), which option represents the activation tree of main?

- A.(A)✓
- B.(B)
- C.(C)
- D.(D)
Answer: A
Solution
Answer: (A) main calls f1, then f2(2), then f3. Inside f2(2): it first calls f3, then (since X!=1) calls f2(1); f2(1) calls f3 then f1. So under f2 the children are f3 and f2(1), and under f2(1) are f3 and f1. The activation tree with main's children {f1, f2, f3}, f2's children {f3, f2}, and the inner f2's children {f3, f1} matches option (A). - A.
More GATE PYQ on Runtime Environment
All GATE CS Compiler Design PYQ →Attempt GATE CS 2023 in real GATE exam mode
Full paper with a timer, the GATE interface and a topic-wise analysis — free.
Create free account →