🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: Scope and Closures: all 10 questions

Quiz: Scope and Closures · Question 1 of 10

In which order does Python search for a name?

In which order does Python search for a name?

  1. A.Global, Local, Built-in, Enclosing
  2. B.Local, Enclosing, Global, Built-in
  3. C.Built-in, Global, Enclosing, Local
  4. D.Local, Global, Enclosing, Built-in
Answer & explanation

Correct answer: Local, Enclosing, Global, Built-in

The LEGB rule: innermost scope first, built-ins last.

Can you get the rest right without peeking?

Take the timed Quiz: Scope and Closures quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →