Similar questions 2 more →
Runtime Environments & Parameter Passing

Answer & solution
Answer: Both qsort frames and exchange link statically to sort; partition links to qsort(1,3). (no official key was published)
Access (static) links follow lexical nesting, whereas control (dynamic) links follow the caller. Label frames S=sort, Q1=qsort(1,9), Q2=qsort(1,3), P=partition(1,3), E=exchange(1,3). Each line below is a complete snapshot written bottom → top; the parenthesized target is the access link:
1. [S(outer/null)]
2. [S(outer/null)] [Q1(S)]
3. [S(outer/null)] [Q1(S)] [Q2(S)]
4. [S(outer/null)] [Q1(S)] [Q2(S)] [P(Q2)]
5. [S(outer/null)] [Q1(S)] [Q2(S)] [P(Q2)] [E(S)]
The final stack, top first, is:
E : static→S; dynamic→P
P : static→Q2; dynamic→Q2
Q2: static→S; dynamic→Q1
Q1: static→S; dynamic→S
S : static→outer/null; dynamic→outer/null
Recursive Q2 is not lexically declared inside Q1, so its static link must not point to Q1. Partition accesses its enclosing qsort variables such as v through Q2, then global a through Q2→S. Exchange was declared directly inside sort, so its a and x references use E→S, even though partition called it. readarray is not active and has no frame in these snapshots. Return addresses and saved registers may also occupy frames but do not change the links.