Abstract data types Flashcards
What is an abstract data type (ADT)?
An abstract data type is a model for a certain data structure that defines the type of data stored, the operations supported on that data, and the behavior of those operations.
True or False: An abstract data type specifies the implementation details.
False
Which of the following is an example of an abstract data type? A) Array B) Stack C) Integer D) String
B) Stack
What are the two main components of an abstract data type?
The data representation and the operations that can be performed on that data.
Fill in the blank: An abstract data type focuses on ______ and not on implementation.
behavior
What operation would you typically find in a stack ADT?
Push and pop operations.
True or False: A queue is a type of abstract data type that follows the Last In First Out (LIFO) principle.
False
What is the primary characteristic of a queue ADT?
It follows the First In First Out (FIFO) principle.
Which abstract data type allows duplicate elements?
List
What is encapsulation in the context of abstract data types?
Encapsulation is the bundling of data and the methods that operate on that data, restricting access to some of the object’s components.
Fill in the blank: An ADT’s operations are defined in terms of ______.
the effects they have on the data.
What is a common use case for a priority queue ADT?
Scheduling tasks based on priority.
Which of the following is NOT an abstract data type? A) Tree B) Graph C) Variable D) Hash Table
C) Variable
True or False: An abstract data type can be implemented using various data structures.
True
What is a linked list?
A linked list is an abstract data type that consists of a sequence of elements, where each element points to the next.
Fill in the blank: A ______ is an abstract data type that represents a collection of unique elements and allows for efficient membership testing.
set
What distinguishes a stack from a queue?
A stack uses LIFO order, while a queue uses FIFO order.
Which operation is not typically associated with a stack ADT?
Dequeue
What is the primary benefit of using abstract data types?
They provide a clear separation between the interface and implementation.
True or False: The implementation of an abstract data type can change without affecting the code that uses it.
True
Which abstract data type is used to represent hierarchical data?
Tree
Fill in the blank: A graph ADT can represent ______ relationships between objects.
complex
What is the purpose of a hash table?
To provide efficient key-value pair storage and retrieval.
Which of the following operations is common to both stacks and queues? A) Push B) Pop C) Enqueue D) None
D) None