← 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?
- A.The most recently used item
- B.The least recently used item, at the front of the OrderedDict
- C.A random item
- 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 →