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

Quiz: Context Managers · Question 3 of 10

In with Thing() as t:, what is stored in t?

In with Thing() as t:, what is stored in t?

  1. A.Always the Thing object itself
  2. B.Whatever Thing().enter() returns
  3. C.The return value of exit
  4. D.None
Answer & explanation

Correct answer: Whatever Thing().enter() returns

Often enter returns self, but it can return anything.

Can you get the rest right without peeking?

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

Start the quiz →