A singly linked list already has a head reference. What is the time complexity of inserting one new node at the front?
4 Linked Lists Online Quiz Questions
Use this free practice quiz with 20 questions to review 4 Linked Lists, test your knowledge, and prepare for your next test or exam.
Which description correctly identifies the fields normally stored in a node of a doubly linked list?
- A
It stores a payload and two head references.
- B
It stores a payload and a link only to the next node.
- C
It stores a payload, a next link, and a prev link.
- D
It stores a payload and the numeric index of every other node.
Why is accessing an element by index generally faster in an array than in a linked list?
- A
An array can calculate an indexed element’s address directly, while a linked list must follow links from the head to reach that position.
- B
A linked list always provides faster indexed access because its nodes can be stored anywhere in memory.
- C
Both structures require following links from the head before accessing any indexed element.
- D
Neither structure supports access by numeric index.
Which two statements accurately describe linked-list behavior or advantages? Select all correct choices.
- A
It can avoid shifting many existing elements during some insertions.
- B
Its nodes must always occupy consecutive memory locations.
- C
Its nodes can be stored in non-contiguous memory.
- D
It provides constant-time access to every numeric index.
Which two statements correctly distinguish link-update costs from search costs in linked lists? Select all correct choices.
- A
Insertion after a known node always requires shifting all later values.
- B
Deletion after a known predecessor can be performed with a constant number of link updates.
- C
Finding a node by searching from the head is always constant time.
- D
Inserting between known neighboring nodes in a doubly linked list requires updating a constant number of links.
True or false: A singly linked list can move backward directly from a current node without first locating additional information.
- A
True
- B
False
True or false: Sorting a linked list makes ordinary binary search efficient because the list can reach its middle element quickly.
- A
True
- B
False
What term names an optional reference to the last node in a linked list?
What is the worst-case time complexity of searching an unsorted linked list for a value? Enter a standard Big-O expression in inline mathematical notation.
Complete the description of a linked-list node: A node stores a and one or more to other nodes.
To delete a node after a known predecessor in a singly linked list, the pointer update takes time, and the required node reference is the node.
A system needs a linked sequence that is updated frequently. Explain when you would choose a singly linked list rather than a doubly linked list, and when the reverse choice would be justified. Include the relevant trade-offs.
In a conventional singly linked list, how is the end of the list represented during traversal?
- A
The head is set to the last node's payload.
- B
The final node's next link is set to null.
- C
The tail is required to point back to the head.
- D
Every node stores the list's total size in its payload.
What does the head of a linked list identify?
- A
The reference to the first node
- B
The reference to the last node
- C
The number of nodes
- D
The marker for an empty node
True or false: The nodes of a linked list must occupy consecutive memory locations.
- A
True
- B
False
In the node definition for a singly linked list, what is the usual name of the link to the following node?
Which structure usually provides O(1) access to an element by numeric index?
- A
A singly linked list
- B
An array
- C
Both structures equally
- D
Neither structure
A program already has a reference to the node before an insertion position in a singly linked list. What is the time complexity of performing the insertion itself?
- A
O(n), because every node must be copied.
- B
O(n), because the list must always be sorted first.
- C
O(1), because only a small number of links are relinked.
- D
O(n2), because two traversals are required.
In a doubly linked list containing A <-> B <-> C, which updates correctly remove node B when a reference to B is available?
- A
Set A.prev to C and C.next to A
- B
Set A.next to C and C.prev to A
- C
Set B.next to A and B.prev to C
- D
Set A.next and C.next to null
What is the conventional name for an optional reference to the last node of a linked list?