← 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 →- Q1. What does this print? (code)
- Q2. What does Counter(["x"])["y"] return?
- Q3. What does this print? (code)
- Q4. Why is a deque better than a list for a queue?
- Q5. What does this print? (code)
- Q6. Which is true about a namedtuple?
- Q7. How do you get a changed copy of a namedtuple s with a new cgpa?
- Q8. In the LRU cache, what does popitem(last=False) remove?
- Q9. What does this print? (code)
- Q10. What is the risk of writing if d[key]: on a defaultdict just to check a key?