logo

Question detail

Which statement about a local variable is correct?

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

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.

Model answer

What a good answer should say

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

Explanation

Why this works

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

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.