logo

AQA A-Level Computer Science practice

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

Try the question first, then check the answer and practise the same topic again.

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

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.

Related flashcards

No flashcards are published for this page yet.

Related practice questions