The GATE Grind

GATE 2012 CS (CS1) – Question 46

Compiler Design · Runtime Environments · 2 marks · Multiple choice

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?

Diagram for GATE 2012 CS (CS1) question 46
  1. Diagram A
  2. Diagram B
  3. Diagram C
  4. Diagram D

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.

More Runtime Environments questions

All Runtime Environments questions →