GATE 2012 CS (CS1) – Question 46
In a lexically scoped block-structured language, main contains sibling procedures A1 and A2; A2 contains A21. A1 calls A2; A2 calls A21; A21 calls A1; main calls A1. For chain main→A1→A2→A21→A1, which displayed activation records and access links are correct?

Practise this question in The GATE Grind →
Show answer and explanation
Correct answer: (D) Diagram D
Explanation
Static/access links follow lexical parentage, not the dynamic caller. Both A1 frames link to main, A2 links to main, and A21 links to the active A2 frame. The frame pointer identifies the last A1 activation. Diagram D shows exactly these links, so D.