Functions & Scope interview questions

15 Functions & Scope 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 *args?

Junior
  1. A.a declaration that rebinds a name to the nearest enclosing function scope rather than creating a new local
  2. B.a parameter form that collects extra positional arguments into a tuple
  3. C.an anonymous, single-expression function created inline without a def statement
  4. D.a parameter form that collects extra keyword arguments into a dictionary

Answer + AI explanation with Pro

2. Which term means: "a parameter form that collects extra positional arguments into a tuple"?

Junior
  1. A.lambda
  2. B.nonlocal
  3. C.*args
  4. D.LEGB rule

Answer + AI explanation with Pro

3. Which statement is correct?

Junior
  1. A.*args — a parameter form that collects extra positional arguments into a tuple
  2. B.*args — an anonymous, single-expression function created inline without a def statement
  3. C.*args — a parameter form that collects extra keyword arguments into a dictionary
  4. D.*args — a declaration that rebinds a name to the nearest enclosing function scope rather than creating a new local

Answer + AI explanation with Pro

4. What is **kwargs?

Junior
  1. A.a parameter form that collects extra positional arguments into a tuple
  2. B.an anonymous, single-expression function created inline without a def statement
  3. C.a declaration that rebinds a name to the nearest enclosing function scope rather than creating a new local
  4. D.a parameter form that collects extra keyword arguments into a dictionary

Answer + AI explanation with Pro

5. Which term means: "a parameter form that collects extra keyword arguments into a dictionary"?

Junior
  1. A.LEGB rule
  2. B.**kwargs
  3. C.lambda
  4. D.nonlocal

Answer + AI explanation with Pro

6. Which statement is correct?

Junior
  1. A.**kwargs — an anonymous, single-expression function created inline without a def statement
  2. B.**kwargs — a parameter form that collects extra keyword arguments into a dictionary
  3. C.**kwargs — the name-resolution order Python follows: Local, Enclosing, Global, then Built-in scope
  4. D.**kwargs — a parameter form that collects extra positional arguments into a tuple

Answer + AI explanation with Pro

7. What is LEGB rule?

Mid
  1. A.the name-resolution order Python follows: Local, Enclosing, Global, then Built-in scope
  2. B.a parameter form that collects extra positional arguments into a tuple
  3. C.a declaration that rebinds a name to the nearest enclosing function scope rather than creating a new local
  4. D.a parameter form that collects extra keyword arguments into a dictionary

Answer + AI explanation with Pro

8. Which term means: "the name-resolution order Python follows: Local, Enclosing, Global, then Built-in scope"?

Mid
  1. A.LEGB rule
  2. B.nonlocal
  3. C.*args
  4. D.lambda

Answer + AI explanation with Pro

9. Which statement is correct?

Mid
  1. A.LEGB rule — an anonymous, single-expression function created inline without a def statement
  2. B.LEGB rule — a declaration that rebinds a name to the nearest enclosing function scope rather than creating a new local
  3. C.LEGB rule — a parameter form that collects extra positional arguments into a tuple
  4. D.LEGB rule — the name-resolution order Python follows: Local, Enclosing, Global, then Built-in scope

Answer + AI explanation with Pro

10. What is nonlocal?

Senior
  1. A.an anonymous, single-expression function created inline without a def statement
  2. B.a parameter form that collects extra keyword arguments into a dictionary
  3. C.a declaration that rebinds a name to the nearest enclosing function scope rather than creating a new local
  4. D.a parameter form that collects extra positional arguments into a tuple

Answer + AI explanation with Pro

11. Which term means: "a declaration that rebinds a name to the nearest enclosing function scope rather than creating a new local"?

Senior
  1. A.*args
  2. B.nonlocal
  3. C.**kwargs
  4. D.LEGB rule

Answer + AI explanation with Pro

12. Which statement is correct?

Senior
  1. A.nonlocal — an anonymous, single-expression function created inline without a def statement
  2. B.nonlocal — a declaration that rebinds a name to the nearest enclosing function scope rather than creating a new local
  3. C.nonlocal — a parameter form that collects extra keyword arguments into a dictionary
  4. D.nonlocal — the name-resolution order Python follows: Local, Enclosing, Global, then Built-in scope

Answer + AI explanation with Pro

13. What is lambda?

Junior
  1. A.the name-resolution order Python follows: Local, Enclosing, Global, then Built-in scope
  2. B.a parameter form that collects extra keyword arguments into a dictionary
  3. C.a parameter form that collects extra positional arguments into a tuple
  4. D.an anonymous, single-expression function created inline without a def statement

Answer + AI explanation with Pro

14. Which term means: "an anonymous, single-expression function created inline without a def statement"?

Junior
  1. A.**kwargs
  2. B.*args
  3. C.lambda
  4. D.nonlocal

Answer + AI explanation with Pro

15. Which statement is correct?

Junior
  1. A.lambda — the name-resolution order Python follows: Local, Enclosing, Global, then Built-in scope
  2. B.lambda — a parameter form that collects extra positional arguments into a tuple
  3. C.lambda — a parameter form that collects extra keyword arguments into a dictionary
  4. D.lambda — an anonymous, single-expression function created inline without a def statement

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 Functions & Scope 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