Difficulty: Easy
Correct Answer: Bag
Explanation:
Introduction / Context:
Understanding collection semantics is essential when modeling associations and query results. Different collection types offer different guarantees about order and uniqueness, which affect both correctness and performance in queries and methods.
Given Data / Assumptions:
Concept / Approach:
A bag (multiset) is unordered and allows duplicates. A set is unordered and forbids duplicates. A list preserves order and allows duplicates. A dictionary (map) stores key–value pairs with unique keys rather than allowing duplicate elements freely.
Step-by-Step Solution:
Verification / Alternative check:
OQL/ODMG documentation and many programming languages’ collection libraries (e.g., multiset) match the same definitions.
Why Other Options Are Wrong:
Set: no duplicates allowed.
List: ordered sequence.
Dictionary: keyed collection; duplicates governed by keys, not elements.
Common Pitfalls:
Assuming list-without-sorting is “unordered”; lists still maintain insertion/positional order. Confusing bag with set.
Final Answer:
Bag
Discussion & Comments