Similar questions 4 more →
Runtime Environments & Parameter Passing


Your answer
Answer & solution
Answer: C: S1 sees B.x, z, A.y; S2 sees A.x, A.y, C.i (no official key was published)
Lexical lookup searches the enclosing declaration chain. At S1, the local x in B shadows A’s x; B’s z and A’s y are accessible. At S2, procedure C is a sibling of B, not nested inside B, so B’s x and z are inaccessible. C sees its own i and the x, y declared in A. This is option C. The dynamically most recent caller is irrelevant in this Pascal-like lexical-scope question.