Study resource
Programming exam tips
Study Programming with curriculum-aligned Exam Tips resources, practice links, and exam-focused support.
At a glance
exam tips
Resource type
Topic
Programming
Exam tips
Trace parameter values explicitly
When answering a trace question, write down which argument is passed to each parameter before carrying out the subroutine's instructions.
This reduces errors caused by confusing parameter names with the values supplied in the call.
Trace the value back to the caller
When tracing code, identify the value produced at the return statement and replace the subroutine call with that value before completing the calculation.
This prevents confusion between the subroutine's internal calculation and the value ultimately received by the calling routine.
State both scope and lifetime
When explaining a local variable, include that it is accessible only within its subroutine and exists only while that subroutine is executing.
These are separate properties in the specification, so mentioning both gives a complete explanation.
State the scope clearly
When contrasting local and global variables, explicitly say where each can be accessed.
The essential distinction in this topic is that local variables have restricted scope, while global variables have wider scope.
Link each item to its purpose
When explaining a stack frame, explicitly state what the return address, parameters and local variables are used for.
Listing the three items without explaining their roles may not demonstrate how the stack frame supports a subroutine call.
Trace from the base case back out
When tracing recursion, write each call clearly, find the base case, and then evaluate the waiting calls in reverse order.
The recursive calls are made before the earlier calls can finish, so the returned results are combined from the deepest call back to the original call.
Related topics
