AQA · GCSE · Computer Science · Higher
Properties of local variables
State one property of local variables that is not true for all variables.
Write your answer first. You can study the marking guidance whenever you need it.
Study the marking See what earns credit and compare it with a full-mark answer.
Marking points
- 1 May state that access is restricted to the declaring subroutine.
- 2 May state that its lifetime or memory use is limited to execution of the subroutine.
- 3 May state that it has limited scope.
- 4 May state that its identifier can also be used by a different variable outside the subroutine.
Full-mark answer
A local variable can only be accessed within the subroutine in which it is declared.
Why this answer loses marks
A local variable stores a value while a program runs.
That is true of variables generally; the answer needs a property specific to local scope or lifetime.