🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← All topics

Quiz: The collections Module: questions with answers

10 questions, each with the answer and a short explanation.

Take the timed quiz + get a certificate →
  1. Q1. What does this print? (code)
  2. Q2. What does Counter(["x"])["y"] return?
  3. Q3. What does this print? (code)
  4. Q4. Why is a deque better than a list for a queue?
  5. Q5. What does this print? (code)
  6. Q6. Which is true about a namedtuple?
  7. Q7. How do you get a changed copy of a namedtuple s with a new cgpa?
  8. Q8. In the LRU cache, what does popitem(last=False) remove?
  9. Q9. What does this print? (code)
  10. Q10. What is the risk of writing if d[key]: on a defaultdict just to check a key?