Which collection type represents an ordered collection of elements (all of the same type) in object data models and OQL? Choose the most appropriate term.

Difficulty: Easy

Correct Answer: List

Explanation:

Introduction / Context:Different collection types capture different semantics about order and duplication, which affects query results and method contracts. Knowing these distinctions prevents subtle bugs in persistence and retrieval logic.

Given Data / Assumptions:

  • All elements share the same type (typical for declared collections).
  • Order matters (positions/indexes are meaningful).
  • Standard collection taxonomy applies: set, bag, list, dictionary.

Concept / Approach:

A list is an ordered sequence and typically allows duplicates. A set is unordered and forbids duplicates. A bag is unordered and allows duplicates. A dictionary is keyed by unique keys rather than positional index.

Step-by-Step Solution:

Check the “ordered” requirement → list.Confirm homogeneity (same type) → consistent with list declarations.Answer: List.

Verification / Alternative check:

ODMG and many ORMs align “List” with ordered collections; indexes are stable and queries can use positional operations.

Why Other Options Are Wrong:

Set/Bag: explicitly unordered.

Dictionary: key–value store, not a plain ordered sequence.

Common Pitfalls:

Assuming set preserves insertion order; if order is required, do not model as set/bag.

Final Answer:

List

More Questions from Object-Oriented Database

Discussion & Comments

No comments yet. Be the first to comment!
Join Discussion