Functions & Scope interview questions

15 real Functions & Scope questions from the Python bank, as asked in Indian campus drives and tech interviews. Every question has a verified answer and an AI-tutor explanation on placd — free to start.

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
Reveal the answer + AI explanation — free account

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
Reveal the answer + AI explanation — free account

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
Reveal the answer + AI explanation — free account

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
Reveal the answer + AI explanation — free account

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
Reveal the answer + AI explanation — free account

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
Reveal the answer + AI explanation — free account

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
Reveal the answer + AI explanation — free account

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
Reveal the answer + AI explanation — free account

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
Reveal the answer + AI explanation — free account

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
Reveal the answer + AI explanation — free account

Free to start

Answers, AI explanations, and a scored voice mock interview

Sign up free to check your answers with explanations, ask the AI tutor anything on any question, and take one full AI mock interview — scored like a real panel.

Practice Functions & Scope free