🎙 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 5 of 10

What is a closure?

What is a closure?

  1. A.An inner function that remembers variables from the enclosing function after that function has returned
  2. B.A function that closes open files automatically
  3. C.A function with no parameters
  4. D.A function that cannot be called twice
Answer & explanation

Correct answer: An inner function that remembers variables from the enclosing function after that function has returned

The remembered variables live in cells attached to the inner function.

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 →