Decorators & Closures interview questions

15 Decorators & Closures questions from the Python bank, written for Indian campus drives and tech interviews. Every question has a verified answer and an AI-tutor explanation on placd.

Free to start: the 2-minute IT readiness check — six questions and a result.

Take the free IT readiness check

or take a mock interview set up for this area

1. What is decorator?

Junior
  1. A.a callable that wraps another function to extend its behavior, applied with @ syntax above the definition
  2. B.a nested function that captures and remembers variables from its enclosing scope after that scope has returned
  3. C.a helper applied to a wrapper to copy the original function's name, docstring, and metadata onto it
  4. D.a method that receives the class itself as its implicit first argument rather than an instance

Answer + AI explanation with Pro

2. Which term means: "a callable that wraps another function to extend its behavior, applied with @ syntax above the definition"?

Junior
  1. A.closure
  2. B.staticmethod
  3. C.decorator
  4. D.classmethod

Answer + AI explanation with Pro

3. Which statement is correct?

Junior
  1. A.decorator — a callable that wraps another function to extend its behavior, applied with @ syntax above the definition
  2. B.decorator — a helper applied to a wrapper to copy the original function's name, docstring, and metadata onto it
  3. C.decorator — a method bound to neither the instance nor the class, receiving no implicit first argument
  4. D.decorator — a nested function that captures and remembers variables from its enclosing scope after that scope has returned

Answer + AI explanation with Pro

4. What is closure?

Mid
  1. A.a helper applied to a wrapper to copy the original function's name, docstring, and metadata onto it
  2. B.a method that receives the class itself as its implicit first argument rather than an instance
  3. C.a method bound to neither the instance nor the class, receiving no implicit first argument
  4. D.a nested function that captures and remembers variables from its enclosing scope after that scope has returned

Answer + AI explanation with Pro

5. Which term means: "a nested function that captures and remembers variables from its enclosing scope after that scope has returned"?

Mid
  1. A.staticmethod
  2. B.functools.wraps
  3. C.classmethod
  4. D.closure

Answer + AI explanation with Pro

6. Which statement is correct?

Mid
  1. A.closure — a method bound to neither the instance nor the class, receiving no implicit first argument
  2. B.closure — a callable that wraps another function to extend its behavior, applied with @ syntax above the definition
  3. C.closure — a nested function that captures and remembers variables from its enclosing scope after that scope has returned
  4. D.closure — a method that receives the class itself as its implicit first argument rather than an instance

Answer + AI explanation with Pro

7. What is functools.wraps?

Mid
  1. A.a method that receives the class itself as its implicit first argument rather than an instance
  2. B.a helper applied to a wrapper to copy the original function's name, docstring, and metadata onto it
  3. C.a nested function that captures and remembers variables from its enclosing scope after that scope has returned
  4. D.a method bound to neither the instance nor the class, receiving no implicit first argument

Answer + AI explanation with Pro

8. Which term means: "a helper applied to a wrapper to copy the original function's name, docstring, and metadata onto it"?

Mid
  1. A.closure
  2. B.functools.wraps
  3. C.decorator
  4. D.staticmethod

Answer + AI explanation with Pro

9. Which statement is correct?

Mid
  1. A.functools.wraps — a method that receives the class itself as its implicit first argument rather than an instance
  2. B.functools.wraps — a helper applied to a wrapper to copy the original function's name, docstring, and metadata onto it
  3. C.functools.wraps — a nested function that captures and remembers variables from its enclosing scope after that scope has returned
  4. D.functools.wraps — a callable that wraps another function to extend its behavior, applied with @ syntax above the definition

Answer + AI explanation with Pro

10. What is staticmethod?

Senior
  1. A.a nested function that captures and remembers variables from its enclosing scope after that scope has returned
  2. B.a helper applied to a wrapper to copy the original function's name, docstring, and metadata onto it
  3. C.a callable that wraps another function to extend its behavior, applied with @ syntax above the definition
  4. D.a method bound to neither the instance nor the class, receiving no implicit first argument

Answer + AI explanation with Pro

11. Which term means: "a method bound to neither the instance nor the class, receiving no implicit first argument"?

Senior
  1. A.functools.wraps
  2. B.classmethod
  3. C.decorator
  4. D.staticmethod

Answer + AI explanation with Pro

12. Which statement is correct?

Senior
  1. A.staticmethod — a callable that wraps another function to extend its behavior, applied with @ syntax above the definition
  2. B.staticmethod — a method bound to neither the instance nor the class, receiving no implicit first argument
  3. C.staticmethod — a method that receives the class itself as its implicit first argument rather than an instance
  4. D.staticmethod — a nested function that captures and remembers variables from its enclosing scope after that scope has returned

Answer + AI explanation with Pro

13. What is classmethod?

Senior
  1. A.a nested function that captures and remembers variables from its enclosing scope after that scope has returned
  2. B.a method that receives the class itself as its implicit first argument rather than an instance
  3. C.a helper applied to a wrapper to copy the original function's name, docstring, and metadata onto it
  4. D.a method bound to neither the instance nor the class, receiving no implicit first argument

Answer + AI explanation with Pro

14. Which term means: "a method that receives the class itself as its implicit first argument rather than an instance"?

Senior
  1. A.decorator
  2. B.classmethod
  3. C.closure
  4. D.staticmethod

Answer + AI explanation with Pro

15. Which statement is correct?

Senior
  1. A.classmethod — a callable that wraps another function to extend its behavior, applied with @ syntax above the definition
  2. B.classmethod — a method that receives the class itself as its implicit first argument rather than an instance
  3. C.classmethod — a method bound to neither the instance nor the class, receiving no implicit first argument
  4. D.classmethod — a nested function that captures and remembers variables from its enclosing scope after that scope has returned

Answer + AI explanation with Pro

Free to start

Start with a free readiness check

Sign up free for the 2-minute IT readiness check and a scored result. Answers, explanations and the AI tutor on every Decorators & Closures question come with Pro.

Take the free IT readiness check

or take a mock interview set up for this area

24,000+ questions & coding problemsSoftware & IT16,274 questionsGovernment jobs26 examsAptitudenew questions every timeAI practice interviewwith feedback65 topics to practiseMechanical1,149 questionsGATE ME9 papersEngineering Mathematics381 questions2-minute checkfreeDSA Problems1,422Civil1,005 questionsGATE CE9 papersCS Fundamentals1,209 questionsYour scores6 skillsSystem Design25Electrical / EEE1,047 questionsGATE EE9 papersRun your codeC++ · Java · PythonLow-Level Design144Electronics & Comm.975 questionsGATE EC9 papersAI help on every questionFull-Stack6,282Chemical1,005 questionsGATE CH9 papersAI whiteboardsystem designWork abroadEurope · remote · transfersESE ME1 paperGATE practice papers2019–2026ESE CE1 paperDate alertsbefore the last dateESE EE1 paperBehavioural courseHR round practiceESE ET1 paperResume optimizerProSSC JE ME1 paperApplication trackerSSC JE CE1 paperCompany-wise prepSSC JE EE1 paperRole roadmapsRRB JE1 subjectPriced in ₹UPI · cardsISRO SC1 paperGATE CS9 papersIBPS SO IT1 paperUGC NET CS1 paperSSC CGL26 papersIBPS PO26 papersRRB NTPC26 papersSSC CHSL26 papersIBPS Clerk26 papersSBI Clerk26 papersRRB Group D26 papersSSC CPO26 papersSSC GD26 papers