Abstract Data Types (ADT) # MCQs Practice set

Q.1 Which of the following best defines an Abstract Data Type (ADT)?

A specific implementation of data structure
A mathematical model with operations defined on data
A type of variable in programming languages
A memory management technique
Explanation - An ADT is defined by its behavior from the point of view of a user, i.e., the operations allowed on it, not by its implementation.
Correct answer is: A mathematical model with operations defined on data

Q.2 Which of the following is NOT an example of an ADT?

Stack
Queue
Linked List
Binary Search Tree
Explanation - Stack, Queue, and Binary Search Tree are ADTs. Linked List is a data structure implementation, not an abstract type.
Correct answer is: Linked List

Q.3 The main purpose of an ADT is to:

Provide a physical memory layout
Specify operations without implementation details
Reduce CPU usage
Optimize network communication
Explanation - ADTs allow users to work with data without worrying about the underlying implementation.
Correct answer is: Specify operations without implementation details

Q.4 Which operation is typical for a Stack ADT?

Insert at beginning
Push and Pop
Enqueue and Dequeue
Find minimum element
Explanation - Stack is a LIFO structure, and the basic operations are push (insert) and pop (remove).
Correct answer is: Push and Pop

Q.5 Which operation is typical for a Queue ADT?

Push and Pop
Enqueue and Dequeue
Insert and Delete at random position
Peek at all elements
Explanation - Queue is a FIFO structure, with enqueue for adding and dequeue for removing elements.
Correct answer is: Enqueue and Dequeue

Q.6 ADT encapsulates data by providing:

Low-level memory addresses
Operations to manipulate data
Hardware interface
Compiler directives
Explanation - An ADT focuses on the operations that can be performed on data, hiding implementation details.
Correct answer is: Operations to manipulate data

Q.7 Which of the following is a characteristic of an ADT?

Implementation-independent
Platform-dependent
Language-specific
Requires global variables
Explanation - ADTs are independent of implementation; they define the behavior of data and operations abstractly.
Correct answer is: Implementation-independent

Q.8 Which ADT uses LIFO (Last In, First Out) ordering?

Queue
Stack
Priority Queue
Graph
Explanation - Stack follows Last In, First Out ordering, where the last inserted element is removed first.
Correct answer is: Stack

Q.9 Which ADT uses FIFO (First In, First Out) ordering?

Queue
Stack
Tree
Set
Explanation - Queue follows First In, First Out ordering, where the first inserted element is removed first.
Correct answer is: Queue

Q.10 Priority Queue ADT differs from a regular Queue in that:

Elements are removed randomly
Each element has a priority determining removal order
It does not allow insertion
It is implemented using arrays only
Explanation - Priority Queue removes elements based on their priority rather than insertion order.
Correct answer is: Each element has a priority determining removal order

Q.11 The Peek operation in a Stack or Queue ADT:

Removes an element
Returns the element without removing it
Deletes all elements
Sorts the elements
Explanation - Peek allows examining the top/front element without modifying the ADT.
Correct answer is: Returns the element without removing it

Q.12 Which of the following ADTs allows duplicate elements?

Set
Queue
Stack
Both Queue and Stack
Explanation - Queue and Stack ADTs allow duplicates, whereas Set ADT does not allow duplicate elements.
Correct answer is: Both Queue and Stack

Q.13 Which ADT stores elements in hierarchical relationships?

Stack
Queue
Tree
List
Explanation - Tree ADT represents hierarchical data with parent-child relationships.
Correct answer is: Tree

Q.14 A Set ADT primarily supports which operation?

Insert, Delete, Search
Push, Pop
Enqueue, Dequeue
Traverse only
Explanation - Set ADT supports operations to add, remove, and check elements while ensuring no duplicates.
Correct answer is: Insert, Delete, Search

Q.15 Which of these is NOT a property of ADTs?

Encapsulation of data
Implementation detail hiding
Defined operations
Specific memory layout
Explanation - ADTs abstract behavior and operations, not the physical memory layout.
Correct answer is: Specific memory layout

Q.16 Which ADT can be used to implement a recursive function efficiently?

Queue
Stack
Set
Map
Explanation - Stacks are used to store function calls for recursion, following LIFO order.
Correct answer is: Stack

Q.17 What is the difference between an ADT and a data structure?

ADT specifies behavior; data structure implements it
ADT is always dynamic; data structure is static
Data structure is language-independent; ADT is language-specific
There is no difference
Explanation - ADTs define what operations are performed, while data structures define how these operations are implemented.
Correct answer is: ADT specifies behavior; data structure implements it

Q.18 Which ADT is suitable for implementing undo functionality in applications?

Queue
Stack
Set
Priority Queue
Explanation - Undo functionality requires LIFO behavior, which is naturally provided by a Stack ADT.
Correct answer is: Stack

Q.19 Which of the following ADTs allows fast search operations based on key values?

Queue
Stack
Map
List
Explanation - Map ADT stores key-value pairs and allows efficient retrieval based on keys.
Correct answer is: Map

Q.20 In an ADT, the term 'encapsulation' means:

Storing all data in a single memory location
Hiding implementation details and exposing operations
Using global variables
Optimizing CPU instructions
Explanation - Encapsulation in ADTs means users can perform operations without knowing how they are implemented internally.
Correct answer is: Hiding implementation details and exposing operations