Abstract data types Flashcards

1
Q

What is an abstract data type (ADT)?

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

True or False: An abstract data type specifies the implementation details.

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Which of the following is an example of an abstract data type? A) Array B) Stack C) Integer D) String

A

B) Stack

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What are the two main components of an abstract data type?

A

The data representation and the operations that can be performed on that data.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Fill in the blank: An abstract data type focuses on ______ and not on implementation.

A

behavior

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What operation would you typically find in a stack ADT?

A

Push and pop operations.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

True or False: A queue is a type of abstract data type that follows the Last In First Out (LIFO) principle.

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is the primary characteristic of a queue ADT?

A

It follows the First In First Out (FIFO) principle.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Which abstract data type allows duplicate elements?

A

List

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is encapsulation in the context of abstract data types?

A

Encapsulation is the bundling of data and the methods that operate on that data, restricting access to some of the object’s components.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Fill in the blank: An ADT’s operations are defined in terms of ______.

A

the effects they have on the data.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is a common use case for a priority queue ADT?

A

Scheduling tasks based on priority.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Which of the following is NOT an abstract data type? A) Tree B) Graph C) Variable D) Hash Table

A

C) Variable

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

True or False: An abstract data type can be implemented using various data structures.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What is a linked list?

A

A linked list is an abstract data type that consists of a sequence of elements, where each element points to the next.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Fill in the blank: A ______ is an abstract data type that represents a collection of unique elements and allows for efficient membership testing.

17
Q

What distinguishes a stack from a queue?

A

A stack uses LIFO order, while a queue uses FIFO order.

18
Q

Which operation is not typically associated with a stack ADT?

19
Q

What is the primary benefit of using abstract data types?

A

They provide a clear separation between the interface and implementation.

20
Q

True or False: The implementation of an abstract data type can change without affecting the code that uses it.

21
Q

Which abstract data type is used to represent hierarchical data?

22
Q

Fill in the blank: A graph ADT can represent ______ relationships between objects.

23
Q

What is the purpose of a hash table?

A

To provide efficient key-value pair storage and retrieval.

24
Q

Which of the following operations is common to both stacks and queues? A) Push B) Pop C) Enqueue D) None

25
What is polymorphism in the context of abstract data types?
Polymorphism allows different data types to be treated as instances of the same type through a common interface.
26
Fill in the blank: Abstract data types are often implemented using ______ data structures.
concrete
27
What is the main advantage of using a tree ADT?
It allows for efficient searching, insertion, and deletion of data.
28
True or False: A binary tree is a specific type of tree ADT where each node has at most two children.
True
29
What is the difference between a binary tree and a binary search tree?
A binary search tree maintains a sorted order, where the left child is less than the parent and the right child is greater.
30
Which operation is associated with the graph ADT?
Traversal
31
What is the main characteristic of a dynamic array?
It can resize itself when more space is needed.