nerdexam
CompTIA

DS0-001 · Question #146

Which of the following is the preferred data structure for storing hierarchical data models?

The correct answer is B. Tree. Trees are the preferred data structure for hierarchical data because they naturally model parent-child relationships with a single root, branching nodes, and leaf nodes - exactly how hierarchies like file systems, org charts, and XML/JSON documents are structured. Stack (A) is…

Database Fundamentals

Question

Which of the following is the preferred data structure for storing hierarchical data models?

Options

  • AStack
  • BTree
  • CQueue
  • DGraph

How the community answered

(64 responses)
  • A
    5% (3)
  • B
    70% (45)
  • C
    8% (5)
  • D
    17% (11)

Explanation

Trees are the preferred data structure for hierarchical data because they naturally model parent-child relationships with a single root, branching nodes, and leaf nodes - exactly how hierarchies like file systems, org charts, and XML/JSON documents are structured.

  • Stack (A) is wrong: it's a linear LIFO structure used for things like undo operations or function call tracking - no branching, no hierarchy.
  • Queue (C) is wrong: it's a linear FIFO structure used for task scheduling and buffering - again, purely sequential.
  • Graph (D) is wrong: while graphs can represent hierarchies, they're more general (allowing cycles and multiple parents), making them overkill and imprecise for strict hierarchical models.

Memory tip: Think of a family tree - one grandparent (root), children, grandchildren (leaves). That's a tree, not a line (stack/queue) or a web of connections (graph).

Topics

#Tree structures#Hierarchical data#Data modeling

Community Discussion

No community discussion yet for this question.

Full DS0-001 Practice