Data Structures

Linked Lists — Practice MCQs for CCAT

20 Questions Section B: Programming Data Structures

Practice 20 Linked Lists multiple-choice questions designed for CDAC CCAT exam preparation. Click "Show Answer" to reveal the correct option with detailed explanation.

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

Correct Answer: B — 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(1)
BO(n)
CO(log n)
DO(n²)
Show Answer & Explanation

Correct Answer: B — 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
BLast node points to first
CCannot be traversed
DHas fixed size
Show Answer & Explanation

Correct Answer: B — 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?
ASingly linked list
BDoubly linked list
CCircular singly linked list
DNone
Show Answer & Explanation

Correct Answer: B — 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(n)
CO(log n)
DO(n²)
Show Answer & Explanation

Correct Answer: B — 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
CFloyd's Cycle Detection
DDijkstra
Show Answer & Explanation

Correct Answer: C — 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
BStack
CDoubly Linked List + Hash Map
DQueue
Show Answer & Explanation

Correct Answer: C — 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:
ADynamic size
BEasy insertion
CNo random access
DMemory efficient
Show Answer & Explanation

Correct Answer: C — 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
BPrevious node
CNULL
DItself
Show Answer & Explanation

Correct Answer: C — 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
BFaster search
CCan traverse from any node to any other
DBetter cache performance
Show Answer & Explanation

Correct Answer: C — 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
BSpecial header node
CTwo heads
DCircular structure only
Show Answer & Explanation

Correct Answer: B — 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
CFrequent insertions/deletions
DBinary search is needed
Show Answer & Explanation

Correct Answer: C — 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.