Which statement best explains how linked-list nodes are stored?
03 Linked Lists Online Quiz Questions
Use this free practice quiz with 20 questions to review 03 Linked Lists, test your knowledge, and prepare for your next test or exam.
A singly linked list uses head to identify its first node. Which sequence correctly inserts new at the front without losing the existing list?
- A
Set head to null, then set new.next to head.
- B
Set head to new, then set new.next to head.
- C
Set new.next to head, then set head to new.
- D
Set new.next to null, then set head to new.
A singly linked list cannot move directly backward from a node because it does not store a predecessor link.
- A
True
- B
False
What is the conventional name for the reference that identifies the first node of a linked list?
Complete the conceptual singly linked-node definition: a node contains for the stored element and for the link to the following node.
If a singly linked list stores only a head reference, what is the time complexity of appending a new node at the end?
- A
O(n)
- B
O(1)
- C
O(logn)
- D
O(n2)
Which operations can take O(1) time once the relevant location is already known? Select all correct choices.
- A
Inserting after a known node in a singly linked list
- B
Removing a known node from a doubly linked list
- C
Finding a value in an unsorted linked list
- D
Deleting the head node of a singly linked list
In a circular linked list, a traversal that waits for current == null will not stop because the final node links back to the first node.
- A
True
- B
False
A linked list has at least 7 nodes and is accessed sequentially from the head. With zero-based indexing, how many nodes must be visited to retrieve the element at index 6?
In a circular singly linked list, traversal begins at , and the final node's link refers back to the first node.
Which conditions generally favor an array-backed list over a linked list? Select all correct choices.
- A
Elements are frequently accessed by index.
- B
Traversal speed and cache locality are important.
- C
Frequent insertions occur near already known nodes.
- D
Memory overhead from one or more links per node should be minimized.
Compare deleting a node by value in a singly linked list with deleting a known node in a doubly linked list. Explain the relevant time complexities and why the distinction between locating a node and changing links matters.
Why can an array-backed list be faster in practice than a linked list even when the linked list has an O(1) insertion or deletion at a known location?
- A
A linked list always has better practical performance because O(1) is faster than any array operation.
- B
An array-backed list can be faster in practice because contiguous storage improves cache locality and reduces allocation and indirection costs.
- C
An array-backed list cannot support insertion or deletion under any circumstances.
- D
Cache locality matters only for doubly linked lists, not singly linked lists.
If an application must traverse a linked list backward from a node, a doubly linked list is appropriate because it stores prev links.
- A
True
- B
False
Which pair of fields is sufficient for the basic representation of a node in a singly linked list?
- A
dataandnext - B
dataandprevonly - C
headandtailonly - D
indexandcapacity
In a singly linked list, what conventional value represents the fact that the final node has no successor?
Which assignment order correctly inserts a new node at the front of a nonempty singly linked list?
- A
head = new, thennew.next = head - B
new.next = head, thenhead = new - C
new.next = null, thenhead = new - D
head.next = new, thennew = head
What reference identifies the last node when a linked-list implementation explicitly maintains a reference to its final node?
Which feature directly enables traversal from a node toward the beginning of a linked list?
- A
A
nextlink in a singly linked list - B
A
tailreference in any linked list - C
A
prevlink in a doubly linked list - D
A
sizecounter in any linked list
A target node in a doubly linked list is already known. What is the time complexity of inserting one new node immediately before that target?
- A
O(1)
- B
O(logn)
- C
O(n)
- D
O(n2)