Exam-style question
Try this first
Why is it good practice to use local variables inside subroutines where appropriate?.
- A.They limit access to values and reduce unintended interference with other parts of the program
- B.They ensure that every subroutine can directly change the same value
- C.They make variables available after the subroutine has finished
- D.They remove the need to declare variables
Model answer
What a good answer should say
- They limit access to values and reduce unintended interference with other parts of the program
Explanation
Why this works
Restricting a variable to the subroutine that uses it makes the program easier to understand and reduces the risk of accidental changes elsewhere.
Common mistake
No common mistake is linked to this question yet.
