Exam-style question
Try this first
A subroutine has two parameters and three local variables. Which statement best describes the stack frame created for one call?.
- A.It can contain the return address, the two parameters and the three local variables
- B.It contains only the return address because variables are stored in the program code
- C.It contains only the local variables because parameters are stored in the calling subroutine's frame
- D.It contains the return address but cannot contain values associated with variables
Model answer
What a good answer should say
- It can contain the return address, the two parameters and the three local variables
Explanation
Why this works
A stack frame holds the information associated with a particular subroutine call. This includes the return address, parameter values and local variables.
Common mistake
No common mistake is linked to this question yet.
