200-901 Software Development and Design Practice Question
Which data structure in Python would be most appropriate for storing a collection of unique items and performing fast membership tests?
⚠ Common exam trap
Cisco often tests the misconception that a dictionary is the best choice for fast membership tests because it also uses hashing, but the trap is that the question specifically asks for a collection of unique items, not key-value pairs, making a set the more precise and appropriate data structure.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
Set
A set is the correct choice because it is implemented as a hash table in Python, which provides O(1) average-time complexity for membership tests using the `in` operator. Sets automatically enforce uniqueness, meaning duplicate items are not allowed, making them ideal for storing a collection of distinct elements. This directly matches the requirement for fast membership testing and uniqueness.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Tuple
Why it's wrong here
Tuples are immutable and membership tests are O(n).
- ✓
Set
Why this is correct
Sets are designed for unique elements and fast membership testing.
- ✗
List
Why it's wrong here
Lists can contain duplicates and membership tests are O(n).
- ✗
Dictionary
Why it's wrong here
Dictionaries store key-value pairs; membership tests on keys are fast, but storing only values would waste memory.
Go deeper
Related to this question
About these practice questions
One of 989 original 200-901 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This 200-901 practice question is part of Courseiva's free Cisco certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the 200-901 exam.