← 🧱 Runtime Environments
Subtopic 1 of 4

7.1Activation records and the control stack

Every call pushes an activation record: actual parameters, return value, return address, control link (caller), access link (for static scope), saved registers, locals and temporaries. Return pops it.

stack empty
Stack grows upward. Each call gets its own record holding parameters, locals, return address and links.
  • main calls fact(3)
  • call fact(3): push activation record
  • call fact(2): push activation record
  • call fact(1): push activation record
  • fact(1) returns 1: pop its record
  • fact(2) = 2 × 1 = 2: pop
  • fact(3) = 3 × 2 = 6: pop, control returns to main with 6

Previous year questions: Runtime Environments (2)

PYQs are grouped by topic, so this is the full set for Runtime Environments; try the ones that match this subtopic. Open all 2 on the topic page.