logo

AQA A-Level Computer Science practice

When does a local variable normally exist?

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

When does a local variable normally exist?.

  1. A.Only while the subroutine that declared it is executing
  2. B.From the start of the program until the program ends
  3. C.Only when another subroutine uses it
  4. D.Permanently after its first assignment

Answer and explanation

Concise answer

Only while the subroutine that declared it is executing

Why this is correct

A local variable is created for the execution of its subroutine and exists only during that execution.

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