Exam-style question
Try this first
What is a local variable?.
- A.A variable declared inside a subroutine and accessible only there
- B.A variable that can be accessed by every subroutine in a program
- C.A variable whose value cannot change during program execution
- D.A variable that is automatically saved after a program ends
Model answer
What a good answer should say
- A variable declared inside a subroutine and accessible only there
Explanation
Why this works
A local variable belongs to the subroutine in which it is declared. It cannot be accessed from outside that subroutine.
Common mistake
No common mistake is linked to this question yet.
