1. Home
  2. Data Science
  3. Python
  4. Which collections class provides default values for…

Added 25 Nov 2026

Which collections class provides default values for missing keys in Python?

  1. OrderedDict
  2. Counter
  3. defaultdict Correct answer
  4. deque

Correct answer

C. defaultdict

5 views

MCQSEXAM

Explanation

defaultdict calls a factory function to create a value for a missing key.

Reference

Asked in: Python Interview Dictionaries

https://docs.python.org/3/tutorial/datastructures.html#dictionaries

Preparing for an exam?

Doubts & discussion

Not sure why the answer is C? Ask here and get an explanation.

Ask a doubt about this MCQ

Shown after review. No links please.

More Python MCQs

Practise all Python MCQs

Similar MCQs