The variable difference in the subroutine shown in Figure 1 is local to that subroutine.
SUBROUTINE checkSpeed(currentSpeed, speedLimit)
difference ← currentSpeed - speedLimit
IF difference > 0 THEN
RETURN true
ELSE
RETURN false
ENDIF
ENDSUBROUTINE
Figure 1
State two properties that only apply to local variables.
Practise AQA GCSE Computer Science Structured programming and subroutines (procedures and functions) with exam-style questions for GCSE Computer Science. 100 questions, matched to the AQA GCSE Computer Science (8525) specification and written in Paper 1 and Paper 2 style. Every question includes a full worked solution and mark scheme, so you can see where marks are awarded rather than just whether you got the answer right.