logo

AQA A-Level Computer Science practice

Which statement about a local variable is correct?

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

Which statement about a local variable is correct?.

  1. A.It is automatically available in every function.
  2. B.It is defined within a limited part of the program and is not generally available outside that part.
  3. C.It must have the same name as a global variable.
  4. D.It can only be used in programs written in Python.

Answer and explanation

Concise answer

It is defined within a limited part of the program and is not generally available outside that part.

Why this is correct

A local variable has a restricted scope. Its use is limited to the local section in which it is defined, such as a function.

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