Skip to content

9618 · 10.4

Introduction to Abstract Data Types (ADT) — common mistakes

Common exam mistakes on 9618 Introduction to Abstract Data Types (ADT). Learn what loses marks, then practise the topic with Examiner’s Ink.

Exam tip 1

In exams, when asked to describe an ADT like a stack or queue, focus purely on the abstract properties. Define the data it holds and list the names and purposes of its operations (e.g., PUSH, POP, ENQUEUE, DEQUEUE). Do not mention arrays, pointers, or any specific programming code unless the question explicitly asks for an implementation.

Why not just always use the data structure directly? Why add the 'abstract' layer?

Using an ADT decouples the logic of your main program from the specific implementation of the data storage. This has huge benefits. If you find that your array-based queue is too slow, you can swap it out for a more efficient linked-list implementation without changing a single line of code in your main program, as long as the interface (ENQUEUE, DEQUEUE, etc.) remains the same. This makes your code more modular, maintainable, and reusable.

Are ADTs only used in Object-Oriented Programming (OOP)?

No, while OOP languages like Java or C# have features like classes, private members, and public methods that map very naturally to the concepts of encapsulation and information hiding, the principles of ADTs can be applied in any programming paradigm. In a procedural language like C or Pascal, you can implement an ADT by grouping related data in a struct or record and providing a set of functions that operate on a pointer to that structure, effectively creating a public interface.