logo

Question detail

Why is it good practice to use local variables inside subroutines where appropriate?

Try the question, check the answer, then read the explanation to understand the curriculum point.

At a glance

MCQ

Type

practice

Style

Topic

Programming

Exam-style question

Try this first

Why is it good practice to use local variables inside subroutines where appropriate?.

  1. A.They limit access to values and reduce unintended interference with other parts of the program
  2. B.They ensure that every subroutine can directly change the same value
  3. C.They make variables available after the subroutine has finished
  4. 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.

Related flashcards

No flashcards are published for this page yet.

Related practice questions

No questions are published for this page yet.