logo

AQA A-Level Computer Science practice

What is a local variable?

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

What is a local variable?.

  1. A.A variable declared inside a subroutine and accessible only there
  2. B.A variable that can be accessed by every subroutine in a program
  3. C.A variable whose value cannot change during program execution
  4. D.A variable that is automatically saved after a program ends

Answer and explanation

Concise answer

A variable declared inside a subroutine and accessible only there

Why this is correct

A local variable belongs to the subroutine in which it is declared. It cannot be accessed from outside that subroutine.

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