Exam-style question
Try this first
Explain how a tree can be used as an example of a data abstraction built through composition. Your answer should refer to data objects, compound data and why the tree is an example of composition.
Model answer
What a good answer should say
- A tree can be built by combining individual data objects into a compound data structure.
- Each object can represent part of the tree, and the combined objects represent the complete tree.
- The tree is therefore a data abstraction formed through composition because separate data objects have been combined to form compound data.
Explanation
Why this works
The essential points are that separate data objects are combined, the result is compound data, and a tree is an example of a data abstraction created in this way.
Common mistake
No common mistake is linked to this question yet.
