1. Home
  2. Data Science
  3. Python
  4. What is a closure in Python?

Added 25 Nov 2026

What is a closure in Python?

  1. A function without arguments
  2. A function that remembers variables from its enclosing scope Correct answer
  3. A class method
  4. A closed file

Correct answer

B. A function that remembers variables from its enclosing scope

5 views

MCQSEXAM

Explanation

A closure retains access to variables of the enclosing function even after it has returned.

Reference

Asked in: Python Interview Functions

https://docs.python.org/3/tutorial/controlflow.html#defining-functions

Preparing for an exam?

Doubts & discussion

Not sure why the answer is B? Ask here and get an explanation.

Ask a doubt about this MCQ

Shown after review. No links please.

More Python MCQs

Practise all Python MCQs

Similar MCQs