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
Answer and explanation
Concise answer
They limit access to values and reduce unintended interference with other parts of the program
Why this is correct
Restricting a variable to the subroutine that uses it makes the program easier to understand and reduces the risk of accidental changes elsewhere.
Use the concise answer above for a quick check, then reveal the full model answer and detailed explanation.
Common mistake
No common mistake is linked to this question yet.
