Back to Practice Data Structures

Linked Lists - Practice MCQs for CCAT

50 Questions Section B: Programming Data Structures

Linked Lists Question Bank for C-CAT

Topic-wise Linked Lists MCQs for CDAC C-CAT preparation with answers and explanations.

Q1.
Which operation is faster in linked list compared to array?
AInsertion at beginning
BAccessing by index
CBinary search
DRandom access
Show Answer & Explanation

Correct Answer: A - Insertion at beginning

Insertion at beginning of linked list is O(1), while array requires O(n) shifting.

Q2.
Time complexity to access nth element in linked list:
AO(n)
BO(1)
CO(log n)
DO(n²)
Show Answer & Explanation

Correct Answer: A - O(n)

We need to traverse from head to reach nth element, taking O(n) time.

Q3.
In a doubly linked list, each node contains:
AOne pointer
BTwo pointers
CThree pointers
DNo pointers
Show Answer & Explanation

Correct Answer: B - Two pointers

Each node has pointers to both next and previous nodes.

Q4.
A circular linked list:
AHas no end
BHas fixed size
CCannot be traversed
DLast node points to first
Show Answer & Explanation

Correct Answer: D - Last node points to first

In circular linked list, the last node points back to the first node.

Q5.
To delete a node in singly linked list, we need:
AOnly the node to delete
BPointer to previous node
CPointer to next node
DBoth previous and next
Show Answer & Explanation

Correct Answer: B - Pointer to previous node

We need pointer to previous node to update its next pointer.

Q6.
Which linked list allows traversal in both directions?
ADoubly linked list
BSingly linked list
CCircular singly linked list
DNone
Show Answer & Explanation

Correct Answer: A - Doubly linked list

Doubly linked list has both next and prev pointers for bidirectional traversal.

Q7.
Insertion at end of singly linked list (with only head) takes:
AO(1)
BO(log n)
CO(n)
DO(n²)
Show Answer & Explanation

Correct Answer: C - O(n)

We need to traverse to the end, taking O(n) time.

Q8.
To detect a cycle in linked list, which algorithm is used?
ADFS
BBFS
CDijkstra
DFloyd's Cycle Detection
Show Answer & Explanation

Correct Answer: D - Floyd's Cycle Detection

Floyd's cycle detection (tortoise and hare) uses two pointers at different speeds.

Q9.
Which data structure is best for implementing LRU cache?
AArray
BDoubly Linked List + Hash Map
CStack
DQueue
Show Answer & Explanation

Correct Answer: B - Doubly Linked List + Hash Map

LRU cache uses doubly linked list for O(1) removal and hash map for O(1) lookup.

Q10.
Disadvantage of linked list over array:
ANo random access
BEasy insertion
CDynamic size
DMemory efficient
Show Answer & Explanation

Correct Answer: A - No random access

Linked lists don't support random access - must traverse sequentially.

Q11.
What is the space complexity of a singly linked list with n nodes?
AO(1)
BO(n)
CO(log n)
DO(n²)
Show Answer & Explanation

Correct Answer: B - O(n)

Each node requires constant space, so n nodes require O(n) space.

Q12.
In a singly linked list, what does the last node point to?
AFirst node
BNULL
CPrevious node
DItself
Show Answer & Explanation

Correct Answer: B - NULL

In a singly linked list, the last node's next pointer is NULL indicating end of list.

Q13.
Which operation is O(1) in a doubly linked list with tail pointer?
ASearch
BDelete from end
CFind middle
DSort
Show Answer & Explanation

Correct Answer: B - Delete from end

With a tail pointer and prev pointers, deleting from end is O(1) in doubly linked list.

Q14.
What is the main advantage of circular linked list over singly linked list?
ALess memory
BCan traverse from any node to any other
CFaster search
DBetter cache performance
Show Answer & Explanation

Correct Answer: B - Can traverse from any node to any other

In circular linked list, we can reach any node from any other node by continuous traversal.

Q15.
To find the middle element of linked list efficiently, we use:
ATwo traversals
BSlow and fast pointer technique
CRandom access
DBinary search
Show Answer & Explanation

Correct Answer: B - Slow and fast pointer technique

Slow pointer moves one step, fast pointer moves two steps. When fast reaches end, slow is at middle.

Q16.
Header linked list contains:
ANo head
BTwo heads
CSpecial header node
DCircular structure only
Show Answer & Explanation

Correct Answer: C - Special header node

Header linked list has a special header node at the beginning that may contain metadata.

Q17.
What is the time complexity to reverse a singly linked list?
AO(1)
BO(n)
CO(n²)
DO(log n)
Show Answer & Explanation

Correct Answer: B - O(n)

Reversing requires traversing all n nodes once, changing pointers, giving O(n) complexity.

Q18.
Linked list is preferred over array when:
ARandom access is frequent
BSize is fixed
CBinary search is needed
DFrequent insertions/deletions
Show Answer & Explanation

Correct Answer: D - Frequent insertions/deletions

Linked lists excel at frequent insertions and deletions as no shifting is required.

Q19.
XOR linked list uses:
ATwo pointers per node
BXOR of addresses of prev and next
CBitwise AND
DOnly next pointer
Show Answer & Explanation

Correct Answer: B - XOR of addresses of prev and next

XOR linked list stores XOR of previous and next addresses in one pointer field, saving memory.

Q20.
Skip list improves linked list by:
ARemoving all pointers
BAdding multiple levels of pointers
CUsing arrays
DCircular structure
Show Answer & Explanation

Correct Answer: B - Adding multiple levels of pointers

Skip list has multiple levels of forward pointers allowing O(log n) search on average.

Q21.
What is the time complexity of inserting a node at the beginning of a singly linked list?
AO(log n)
BO(n)
CO(1)
DO(n²)
Show Answer & Explanation

Correct Answer: C - O(1)

Inserting at the beginning only requires creating a new node, setting its next pointer to the current head, and updating the head pointer — all constant-time operations.

Q22.
What is the main advantage of a linked list over an array?
AFaster random access
BBetter cache performance
CDynamic size and efficient insertion/deletion
DLess memory usage per element
Show Answer & Explanation

Correct Answer: C - Dynamic size and efficient insertion/deletion

Linked lists can grow and shrink dynamically without pre-allocation, and insertion/deletion at any position requires only pointer updates (O(1) if the position is known), unlike arrays which need shifting.

Q23.
In a singly linked list, what is the time complexity of deleting the last node?
AO(1)
BO(n)
CO(log n)
DO(n²)
Show Answer & Explanation

Correct Answer: B - O(n)

To delete the last node, we must traverse the entire list to find the second-to-last node (to update its next pointer to NULL), requiring O(n) time.

Q24.
How many pointers does each node in a doubly linked list contain?
A1
BDepends on data
C3
D2
Show Answer & Explanation

Correct Answer: D - 2

Each node in a doubly linked list contains two pointers: one pointing to the next node and one pointing to the previous node, enabling traversal in both directions.

Q25.
In a circular linked list, the last node's next pointer points to:
ANULL
BItself
CThe second node
DThe head node
Show Answer & Explanation

Correct Answer: D - The head node

In a circular linked list, the last node's next pointer points back to the head (first) node, forming a circular chain with no NULL terminator.

Q26.
What is the time complexity of searching for an element in a singly linked list of n nodes?
AO(n)
BO(log n)
CO(1)
DO(n²)
Show Answer & Explanation

Correct Answer: A - O(n)

Searching requires sequential traversal from the head node since there is no random access. In the worst case, we must visit all n nodes, giving O(n).

Q27.
Which operation is more efficient in a doubly linked list compared to a singly linked list?
AInsertion at the beginning
BSearching for an element
CTraversal
DDeletion of a given node (when pointer to the node is given)
Show Answer & Explanation

Correct Answer: D - Deletion of a given node (when pointer to the node is given)

In a doubly linked list, if we have a pointer to the node to delete, we can access its previous node directly. In a singly linked list, we must traverse from the head to find the previous node.

Q28.
What is the space complexity of a singly linked list with n nodes?
AO(n)
BO(1)
CO(n²)
DO(log n)
Show Answer & Explanation

Correct Answer: A - O(n)

A singly linked list stores n nodes, each containing data and a next pointer. The total space used is proportional to n, giving O(n) space complexity.

Q29.
Floyd's cycle detection algorithm uses how many pointers?
A1
B3
C2
D4
Show Answer & Explanation

Correct Answer: C - 2

Floyd's algorithm uses two pointers: a slow pointer (moves one step at a time) and a fast pointer (moves two steps at a time). If a cycle exists, they will eventually meet.

Q30.
What is the time complexity of reversing a singly linked list iteratively?
AO(1)
BO(n log n)
CO(n²)
DO(n)
Show Answer & Explanation

Correct Answer: D - O(n)

Reversing iteratively requires a single traversal through all n nodes, changing each node's next pointer to point to the previous node, giving O(n) time.

Q31.
Which of the following is a disadvantage of a linked list?
ANo random access (sequential access only)
BEfficient insertion at any position
CDynamic memory allocation
DNo fixed size limitation
Show Answer & Explanation

Correct Answer: A - No random access (sequential access only)

Linked lists do not support random access. To access the k-th element, we must traverse from the head through k nodes, making access O(k) instead of O(1) as in arrays.

Q32.
In a doubly linked list, what is the time complexity of inserting a node before a given node (when a pointer to that node is provided)?
AO(n²)
BO(n)
CO(log n)
DO(1)
Show Answer & Explanation

Correct Answer: D - O(1)

With a pointer to the given node in a doubly linked list, we can access its previous node directly and insert the new node by updating four pointers — all in constant time.

Q33.
A header linked list is a linked list that:
AHas no head pointer
BIs always sorted
CContains a special header node at the beginning
DUses an array for storage
Show Answer & Explanation

Correct Answer: C - Contains a special header node at the beginning

A header linked list includes a special header (sentinel) node at the beginning that doesn't store actual data. It simplifies operations by eliminating special cases for the empty list.

Q34.
What is the time complexity of finding the middle element of a singly linked list in one pass?
AO(1)
BO(n/2)
CO(n)
DCannot be done in one pass
Show Answer & Explanation

Correct Answer: C - O(n)

Using the slow-fast pointer technique (slow moves 1 step, fast moves 2 steps), when fast reaches the end, slow is at the middle. This requires one pass through the list, which is O(n).

Q35.
In a circular doubly linked list, the previous pointer of the head node points to:
ANULL
BThe head itself
CThe last node
DThe second node
Show Answer & Explanation

Correct Answer: C - The last node

In a circular doubly linked list, the head's previous pointer points to the last node, and the last node's next pointer points to the head, forming a complete circle in both directions.

Q36.
How can you detect if two singly linked lists merge at some point (Y-shaped intersection)?
ABoth A and B are correct approaches
BFind lengths, align, and compare — O(m+n)
CCompare all node pairs — O(m×n)
DIt's not possible to detect
Show Answer & Explanation

Correct Answer: A - Both A and B are correct approaches

Both approaches work. Comparing all pairs gives O(m×n), while the length-difference approach aligns the starting points and compares nodes in O(m+n). The latter is more efficient.

Q37.
What is the extra space used per node in a doubly linked list compared to a singly linked list?
ATwo extra pointers
BOne extra pointer
COne extra data field
DNo extra space
Show Answer & Explanation

Correct Answer: B - One extra pointer

A doubly linked list node has an additional previous pointer compared to a singly linked list node, which has only a next pointer. This is one extra pointer per node.

Q38.
Which linked list allows traversal in both directions?
ASingly linked list
BCircular singly linked list
CDoubly linked list
DHeader linked list
Show Answer & Explanation

Correct Answer: C - Doubly linked list

A doubly linked list has both next and previous pointers in each node, allowing traversal in forward and backward directions. Singly linked lists only support forward traversal.

Q39.
To insert a node at the end of a singly linked list (without a tail pointer), the time complexity is:
AO(1)
BO(n²)
CO(log n)
DO(n)
Show Answer & Explanation

Correct Answer: D - O(n)

Without a tail pointer, we must traverse the entire list to find the last node before we can insert a new node after it, resulting in O(n) time.

Q40.
What advantage does a circular linked list have over a singly linked list?
AAny node can be used as the starting point for traversal
BFaster searching
CUses less memory
DSupports random access
Show Answer & Explanation

Correct Answer: A - Any node can be used as the starting point for traversal

In a circular linked list, since the last node points back to the first, traversal can start from any node and still visit all nodes by following next pointers until we return to the starting node.

Q41.
In the XOR linked list (memory-efficient doubly linked list), each node stores:
ATwo separate pointers (next and prev)
BOnly the next pointer
CSum of addresses of previous and next nodes
DXOR of addresses of previous and next nodes
Show Answer & Explanation

Correct Answer: D - XOR of addresses of previous and next nodes

The XOR linked list stores the XOR of the previous and next node addresses in a single pointer field, reducing memory usage compared to a standard doubly linked list.

Q42.
When deleting a node from a singly linked list (given pointer to the node, not the previous node), what technique can be used?
AIt's impossible without the previous pointer
BSwap with the head and delete the head
CCopy data from the next node and delete the next node
DTraverse from the head to find the previous node
Show Answer & Explanation

Correct Answer: C - Copy data from the next node and delete the next node

We can copy the data from the next node into the current node, then delete the next node by updating the current node's next pointer. This won't work for the last node.

Q43.
What is the time complexity of merging two sorted singly linked lists into one sorted list?
AO(m + n)
BO(m × n)
CO(m × log n)
DO((m+n) log(m+n))
Show Answer & Explanation

Correct Answer: A - O(m + n)

Using the two-pointer merge technique, we compare current nodes of both lists and link the smaller one to the result. Each node is visited once, giving O(m + n).

Q44.
A self-organizing linked list uses which strategy to improve search efficiency?
AMove-to-front or transpose heuristic
BBinary search
CSorting after every insertion
DHash-based indexing
Show Answer & Explanation

Correct Answer: A - Move-to-front or transpose heuristic

Self-organizing lists rearrange nodes based on access patterns. The move-to-front heuristic moves accessed nodes to the head, while transpose swaps them with their predecessor.

Q45.
What is the time complexity of inserting a node at the beginning of a circular singly linked list (given pointer to the last node)?
AO(1)
BO(n)
CO(log n)
DO(n²)
Show Answer & Explanation

Correct Answer: A - O(1)

With a pointer to the last node, we can insert at the beginning by creating a new node, setting its next to last->next (the head), and updating last->next to the new node — all in O(1).

Q46.
What data structure is most suitable for implementing a polynomial using linked lists?
ACircular linked list with only exponents
BDoubly linked list with only coefficients
CSingly linked list with coefficient and exponent in each node
DArray-based linked list
Show Answer & Explanation

Correct Answer: C - Singly linked list with coefficient and exponent in each node

Each node stores a coefficient and exponent, and the next pointer links to the next term. This allows efficient storage of sparse polynomials where many coefficients are zero.

Q47.
If a singly linked list has n nodes, the total number of pointer fields is:
A2n
Bn + 1
Cn - 1
Dn
Show Answer & Explanation

Correct Answer: D - n

Each of the n nodes has exactly one next pointer, so there are n pointer fields in total. Additionally, there is a head pointer, but that is external to the nodes.

Q48.
What is the time complexity of splitting a linked list into two halves using the slow-fast pointer approach?
AO(n)
BO(log n)
CO(1)
DO(n²)
Show Answer & Explanation

Correct Answer: A - O(n)

The fast pointer traverses the entire list (n nodes) while the slow pointer reaches the middle. This single traversal takes O(n) time.

Q49.
In a linked list implementation of a stack, push and pop operations have what time complexity?
AO(1) and O(n)
BO(n) and O(1)
CO(n) and O(n)
DO(1) and O(1)
Show Answer & Explanation

Correct Answer: D - O(1) and O(1)

Using the head of the linked list as the top of the stack, push (insert at head) and pop (delete from head) both require only constant-time pointer operations.

Q50.
What is the purpose of a sentinel (dummy) node in a linked list?
ATo store extra data
BTo improve search performance
CTo simplify boundary conditions and edge cases
DTo enable random access
Show Answer & Explanation

Correct Answer: C - To simplify boundary conditions and edge cases

A sentinel node eliminates special cases for empty lists and operations at the head/tail. It simplifies code by ensuring there is always a node before the first real element and after the last.

Showing 1-10 of 50 questions