Deck 16: Linked Lists

Full screen (f)
exit full mode
Question
In a linked list, the order of the nodes is determined by the address, called the ____, stored in each node.

A) head
B) tail
C) link
D) first
Use Space or
up arrow
down arrow
to flip the card.
Question
What is the purpose of the following code? <strong>What is the purpose of the following code?  </strong> A) Insertion of a node B) Selection of a node C) Traversal of a linked list D) Creation of a new list <div style=padding-top: 35px>

A) Insertion of a node
B) Selection of a node
C) Traversal of a linked list
D) Creation of a new list
Question
A doubly linked list can be traversed in either direction.
Question
It is not possible to create an ordered linked list.
Question
In a linked list, if a new item is always inserted at the beginning or at the end of the list and the data we read is unsorted, the linked list will be unsorted.
Question
Linked lists allow you to overcome the size limitations of an array data type.
Question
Every node (except of the last node) in a singly linked list contains ____.

A) the next node
B) no address information
C) the address of the next node
D) the address of the previous node
Question
Suppose that the pointer head points to the first node in the list, and the link of the last node is nullptr.The first node of the linked list contains the address of the ____ node.

A) head
B) first
C) second
D) tail
Question
Memory for the components of an array does not need to be contiguous.
Question
You can use the pointer head of a linked list to traverse the list.
Question
In a linked list, the address of the first node in the list is stored in a separate location, called the ____ or first.

A) head
B) pointer
C) front
D) top
Question
A linked list is a random access data structure.
Question
The length of a linked list is the number of nodes in the list.
Question
The link field of the last node of a linked list is ____.

A) nullptr
B) 1
C) n-1
D) n
Question
Because each node of a linked list has two components, we need to declare each node as a(n) ____.

A) reference and string
B) int and object
C) index and element
D) class or struct
Question
A linked list is a collection of components, called ____.

A) elements
B) nodes
C) members
D) pointers
Question
Each node of a singly linked list has two components: ____ and ____.

A) info, head
B) link, back
C) back, head
D) info, link
Question
We deallocate the memory for a linked list by calling the operator clear.
Question
When you build a linked list in the backward manner, a new node is always inserted at the end of the linked list.
Question
Data can be organized and processed sequentially using an array, called a(n) ____ list.

A) linked
B) ordered
C) sequential
D) ascending
Question
In C++, the dereferencing operator is ____________________.
Question
Which of the following is a basic operation on singly linked lists?

A) Retrieve the data of an arbitrary node.
B) Swap the head and the last nodes.
C) Determine whether the list is nearly full.
D) Make a copy of the linked list.
Question
Create a new node.
2.Store the new item in the new node.
3.Insert the node before first.
d.
Question
Consider the accompanying code.What is the effect of the following statement? newNode->info = 50;

A) Stores 50 in the info field of the newNode
B) Creates a new node
C) Places the node at location 50
D) Cannot be determined from this code
Question
The ____ deallocates the memory occupied by the nodes of a list when the class object goes out of scope.

A) constructor
B) destructor
C) head pointer
D) tail pointer
Question
Consider the following code which deletes all the nodes in a linked list. <strong>Consider the following code which deletes all the nodes in a linked list.   Which of the following is the missing statement?</strong> A) delete first; B) delete temp; C) destroy temp; D) clear temp; <div style=padding-top: 35px> Which of the following is the missing statement?

A) delete first;
B) delete temp;
C) destroy temp;
D) clear temp;
Question
The steps involved in inserting a new item at the beginning of an unordered linked list are ____.
a.
Question
Create a new node. 2.Store the new item in the new node.
3)Insert the node before first.
4)Decrement the counter by 1.
Question
Every node in a doubly linked list has two pointers: ____ and ____.

A) top; bottom
B) back; next
C) current; forward
D) previous; forward
Question
Which of the following correctly initializes a doubly linked list in the default constructor?

A) head = nullptr;
Back = nullptr;
B) head = 0;
Back = 0;
Count = 0;
C) first = 0;
Last = 0;
D) first = nullptr;
Last = nullptr;
Count = 0;
Question
When building a linked list in the ____ manner, a new node is always inserted at the end of the linked list.

A) backward
B) forward
C) traversal
D) random
Question
A(n) ____________________ is an object that produces each element of a container, such as a linked list, one element at a time.
Question
Which of the following statements appears in the insert function of a doubly linked list?

A) current++;
B) trailCurrent++;
C) newNode++;
D) count++;
Question
In a linked list, the link component of each node is a(n) ____________________.
Question
Create a new node.
2.Store the new item in the new node.
3.Insert the node before first.
4.Increment the counter by 1.
c.
Question
Consider the following code:The statement that provides the length of the linked list is ____. <strong>Consider the following code:The statement that provides the length of the linked list is ____.  </strong> A) cout <<< count; B) destroy(); C) return count; D) return next; <div style=padding-top: 35px>

A) cout <<< count;
B) destroy();
C) return count;
D) return next;
Question
Consider the statements above.The list is empty if the pointer first is ____.

A) nullptr
B) 0
C) last
D) next
Question
Each node of a linked list must store the data as well as the ____________________ of the next node in the list.
Question
Create a new node.
2.Insert the node before first.
3.Increment the counter by 1.
b.
Question
Consider the accompanying statements.The operation returns true if the list is empty; otherwise, it returns false.The missing code is ____.

A) protected
B) int
C) void
D) bool
Question
For classes that include pointer data members, the assignment operator must be explicitly ____________________.
Question
The ____________________ constructor executes when an object is declared and initialized using another object.
Question
A(n) ____________________ linked list is a linked list in which every node has a next pointer and a back pointer.
Question
The ____________________ operator advances the iterator to the next node in the linked list.
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/44
auto play flashcards
Play
simple tutorial
Full screen (f)
exit full mode
Deck 16: Linked Lists
1
In a linked list, the order of the nodes is determined by the address, called the ____, stored in each node.

A) head
B) tail
C) link
D) first
C
2
What is the purpose of the following code? <strong>What is the purpose of the following code?  </strong> A) Insertion of a node B) Selection of a node C) Traversal of a linked list D) Creation of a new list

A) Insertion of a node
B) Selection of a node
C) Traversal of a linked list
D) Creation of a new list
C
3
A doubly linked list can be traversed in either direction.
True
4
It is not possible to create an ordered linked list.
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
5
In a linked list, if a new item is always inserted at the beginning or at the end of the list and the data we read is unsorted, the linked list will be unsorted.
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
6
Linked lists allow you to overcome the size limitations of an array data type.
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
7
Every node (except of the last node) in a singly linked list contains ____.

A) the next node
B) no address information
C) the address of the next node
D) the address of the previous node
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
8
Suppose that the pointer head points to the first node in the list, and the link of the last node is nullptr.The first node of the linked list contains the address of the ____ node.

A) head
B) first
C) second
D) tail
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
9
Memory for the components of an array does not need to be contiguous.
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
10
You can use the pointer head of a linked list to traverse the list.
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
11
In a linked list, the address of the first node in the list is stored in a separate location, called the ____ or first.

A) head
B) pointer
C) front
D) top
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
12
A linked list is a random access data structure.
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
13
The length of a linked list is the number of nodes in the list.
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
14
The link field of the last node of a linked list is ____.

A) nullptr
B) 1
C) n-1
D) n
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
15
Because each node of a linked list has two components, we need to declare each node as a(n) ____.

A) reference and string
B) int and object
C) index and element
D) class or struct
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
16
A linked list is a collection of components, called ____.

A) elements
B) nodes
C) members
D) pointers
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
17
Each node of a singly linked list has two components: ____ and ____.

A) info, head
B) link, back
C) back, head
D) info, link
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
18
We deallocate the memory for a linked list by calling the operator clear.
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
19
When you build a linked list in the backward manner, a new node is always inserted at the end of the linked list.
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
20
Data can be organized and processed sequentially using an array, called a(n) ____ list.

A) linked
B) ordered
C) sequential
D) ascending
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
21
In C++, the dereferencing operator is ____________________.
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
22
Which of the following is a basic operation on singly linked lists?

A) Retrieve the data of an arbitrary node.
B) Swap the head and the last nodes.
C) Determine whether the list is nearly full.
D) Make a copy of the linked list.
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
22
Create a new node.
2.Store the new item in the new node.
3.Insert the node before first.
d.
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
23
Consider the accompanying code.What is the effect of the following statement? newNode->info = 50;

A) Stores 50 in the info field of the newNode
B) Creates a new node
C) Places the node at location 50
D) Cannot be determined from this code
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
24
The ____ deallocates the memory occupied by the nodes of a list when the class object goes out of scope.

A) constructor
B) destructor
C) head pointer
D) tail pointer
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
25
Consider the following code which deletes all the nodes in a linked list. <strong>Consider the following code which deletes all the nodes in a linked list.   Which of the following is the missing statement?</strong> A) delete first; B) delete temp; C) destroy temp; D) clear temp; Which of the following is the missing statement?

A) delete first;
B) delete temp;
C) destroy temp;
D) clear temp;
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
26
The steps involved in inserting a new item at the beginning of an unordered linked list are ____.
a.
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
26
Create a new node. 2.Store the new item in the new node.
3)Insert the node before first.
4)Decrement the counter by 1.
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
27
Every node in a doubly linked list has two pointers: ____ and ____.

A) top; bottom
B) back; next
C) current; forward
D) previous; forward
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
28
Which of the following correctly initializes a doubly linked list in the default constructor?

A) head = nullptr;
Back = nullptr;
B) head = 0;
Back = 0;
Count = 0;
C) first = 0;
Last = 0;
D) first = nullptr;
Last = nullptr;
Count = 0;
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
29
When building a linked list in the ____ manner, a new node is always inserted at the end of the linked list.

A) backward
B) forward
C) traversal
D) random
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
30
A(n) ____________________ is an object that produces each element of a container, such as a linked list, one element at a time.
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
31
Which of the following statements appears in the insert function of a doubly linked list?

A) current++;
B) trailCurrent++;
C) newNode++;
D) count++;
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
32
In a linked list, the link component of each node is a(n) ____________________.
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
32
Create a new node.
2.Store the new item in the new node.
3.Insert the node before first.
4.Increment the counter by 1.
c.
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
33
Consider the following code:The statement that provides the length of the linked list is ____. <strong>Consider the following code:The statement that provides the length of the linked list is ____.  </strong> A) cout <<< count; B) destroy(); C) return count; D) return next;

A) cout <<< count;
B) destroy();
C) return count;
D) return next;
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
34
Consider the statements above.The list is empty if the pointer first is ____.

A) nullptr
B) 0
C) last
D) next
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
35
Each node of a linked list must store the data as well as the ____________________ of the next node in the list.
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
35
Create a new node.
2.Insert the node before first.
3.Increment the counter by 1.
b.
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
36
Consider the accompanying statements.The operation returns true if the list is empty; otherwise, it returns false.The missing code is ____.

A) protected
B) int
C) void
D) bool
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
37
For classes that include pointer data members, the assignment operator must be explicitly ____________________.
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
38
The ____________________ constructor executes when an object is declared and initialized using another object.
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
39
A(n) ____________________ linked list is a linked list in which every node has a next pointer and a back pointer.
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
40
The ____________________ operator advances the iterator to the next node in the linked list.
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
locked card icon
Unlock Deck
Unlock for access to all 44 flashcards in this deck.