What is the main purpose of an activation record in the context of function calls?
Think about what information a program needs to remember when it calls a function and later returns.
An activation record stores all the necessary information for a single function call, including parameters, local variables, and where to return after the function finishes.
Consider three functions: main calls funcA, which calls funcB. How does the call stack change during these calls?
Remember that each function call adds a new activation record on top of the stack.
When functions call other functions, each call adds a new activation record on top of the call stack, preserving the order of calls.
Which part of an activation record is responsible for telling the program where to continue execution after a function returns?
Think about what the program needs to know to resume after finishing a function.
The return address field stores the location in the code where execution should continue after the function call completes.
What is the key difference between static links and dynamic links stored in activation records?
Consider the difference between lexical scope and call history.
Static links help access variables in the surrounding code blocks (lexical scope), while dynamic links help return control to the caller function.
What would most likely happen if an activation record did not store a dynamic link during a function call?
Think about how the program knows where to go after a function finishes.
Without the dynamic link, the program cannot find the caller's activation record to return control, leading to incorrect execution or crash.