Lists Flashcards

1
Q

What is an Abstract Data Type (ADT)?

A

An ADT is a mathematical model for data types where the data type is defined by its behavior from the point of view of a user, particularly in terms of possible values, possible operations on data of this type, and the behavior of these operations.

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

True or False: A list is an example of an Abstract Data Type.

A

True

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

What are the two main properties of a list ADT?

A

The two main properties are that the elements are ordered and that each element can be accessed by its position or index.

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

Fill in the blank: In a list, the first element is typically accessed at index ____.

A

0

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

What operation would you use to add an element to the end of a list?

A

Append

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

True or False: A linked list is a type of list ADT.

A

True

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

What is the main advantage of using a linked list over an array for a list ADT?

A

A linked list can grow and shrink dynamically, allowing for efficient insertions and deletions.

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

Multiple Choice: Which of the following is NOT a standard operation on a list ADT? A) Insert B) Delete C) Sort D) Multiply

A

D) Multiply

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

What is a common way to represent a list in programming languages?

A

Arrays or linked structures.

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

Fill in the blank: The operation to remove an element from a specific position in a list is called ____.

A

Delete

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

True or False: A list can contain duplicate elements.

A

True

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

What does it mean for a list to be ‘ordered’?

A

It means that the elements have a specific sequence or arrangement.

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

Multiple Choice: Which type of list allows for efficient random access? A) Singly Linked List B) Doubly Linked List C) Array List D) Circular Linked List

A

C) Array List

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

What is a ‘singly linked list’?

A

A linked list where each node points to the next node and the last node points to null.

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

True or False: A doubly linked list allows traversal in both directions.

A

True

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

What is the purpose of a ‘head’ pointer in a linked list?

A

It points to the first element of the list.

17
Q

Fill in the blank: In a circular linked list, the last node points back to the ____ node.

18
Q

What is a ‘dynamic array’?

A

An array that can resize itself when elements are added or removed.

19
Q

Multiple Choice: Which operation has O(n) time complexity in an array list? A) Access B) Insert at end C) Delete from beginning D) Append

A

C) Delete from beginning

20
Q

What is the ‘size’ of a list ADT?

A

The number of elements currently stored in the list.

21
Q

True or False: Lists can only store elements of the same data type.

22
Q

What is the difference between a stack and a list ADT?

A

A stack follows Last In First Out (LIFO) order, while a list does not impose any specific order.

23
Q

Fill in the blank: The operation to retrieve an element from a list is called ____.

24
Q

What is a ‘sorted list’?

A

A list where the elements are arranged in a specific order, typically ascending or descending.

25
Multiple Choice: Which of the following is a drawback of using a linked list? A) Dynamic size B) Memory overhead C) Easy insertion D) Fast access
B) Memory overhead
26
What is the 'tail' in a linked list?
The last node of the list, which points to null.