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

Quiz: The collections Module · Question 8 of 10

In the LRU cache, what does popitem(last=False) remove?

In the LRU cache, what does popitem(last=False) remove?

  1. A.The most recently used item
  2. B.The least recently used item, at the front of the OrderedDict
  3. C.A random item
  4. D.The item with the smallest value
Answer & explanation

Correct answer: The least recently used item, at the front of the OrderedDict

Recently used keys are moved to the end, so the front holds the oldest.

Can you get the rest right without peeking?

Take the timed Quiz: The collections Module quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →