Abstract Data Types (ADT)

Unit 2 Β· Topic 2.3⏱ 8 min read❓ 5 MCQs

Introduction

An Abstract Data Type defines a data type by its behavior (operations) rather than its implementation.

Definition

ADT: A type defined by operations, hiding representation.

C++ Code Example

class Stack {
    int arr[100]; int top;
public:
    void push(int x){ arr[++top]=x; }
    int pop(){ return arr[top--]; }
};

Important Questions

Short Questions

  1. Define ADT.
  2. Give examples of ADT.
  3. ADT vs data structure?
  4. Why use ADT?

Long Questions

  1. Explain ADT with stack example.
  2. Discuss benefits of ADT.

MCQ Practice

1. ADT is defined by:

  • Operations/behavior
  • Implementation
  • Memory layout
  • Compiler
Answer: Operations/behavior.

2. Stack is an:

  • ADT
  • Operator
  • Keyword
  • Macro
Answer: ADT.

3. ADT hides:

  • Representation
  • Operations
  • Interface
  • Name
Answer: Representation.

4. Which is an ADT?

  • Queue
  • int
  • char
  • float
Answer: Queue.

5. ADT promotes:

  • Abstraction
  • Speed only
  • Memory only
  • None
Answer: Abstraction.

Quick Revision

  • ADT = behavior, not implementation.
  • Examples: stack, queue, list.