Original Practice Questions
1. A programmer needs a data structure that supports inserting and
removing items from both ends efficiently. Which ADT should be
selected?
A. Stack
B. Queue
C. Deque
D. Set
C. Deque
A deque (double-ended queue) allows insertion and removal at both the front
and back, combining stack and queue behaviors .
2. A hospital triage system must treat the most critically injured
patient first, regardless of arrival order. Which ADT is most
appropriate?
A. Stack
B. Queue
C. Priority queue
D. Bag
C. Priority queue
A priority queue removes the highest-priority element first, which matches
triage ordering by severity rather than arrival time .
3. Which data structure is most appropriate for implementing an
"undo" feature in a text editor?
,A. Queue
B. Stack
C. Priority queue
D. Set
B. Stack
The undo feature reverses the most recent action first, which is LIFO behavior
provided by a stack .
4. A web server processes requests in the order they arrive. Which ADT
models this behavior?
A. Stack
B. Queue
C. Priority queue
D. Dictionary
B. Queue
A queue follows FIFO ordering, so the earliest request is processed first .
5. Which ADT stores items in which order does not matter and
duplicate items are allowed?
A. List
B. Set
C. Bag
D. Dictionary
C. Bag
A bag stores unordered items and permits duplicates. A set allows no
duplicates, and a list maintains order .
,6. What is the primary difference between an abstract data type and a
data structure?
A. An ADT defines behavior; a data structure defines implementation
B. An ADT defines implementation; a data structure defines behavior
C. They are identical concepts
D. An ADT stores data; a data structure does not
A. An ADT defines behavior; a data structure defines implementation
The ADT specifies operations such as push and pop; the data structure
specifies how those operations are carried out in memory .
7. In a singly-linked list, what is the time complexity of inserting a new
node at the head?
A. O(1)
B. O(log n)
C. O(n)
D. O(n²)
A. O(1)
Inserting at the head requires only updating the new node's next pointer and
the head reference, both constant-time operations .
8. In a singly-linked list, what is the time complexity of inserting a new
node at the tail when only the head reference is stored?
A. O(1)
B. O(log n)
C. O(n)
D. O(n²)
C. O(n)
, Without a tail reference, the list must be traversed from the head to reach the
last node .
9. What is a key advantage of a circular linked list over a singly-linked
list?
A. It allows continuous cycling through the list without resetting to the
head
B. It uses less memory per node
C. It always sorts data automatically
D. It eliminates the need for pointers
A. It allows continuous cycling through the list without resetting to the
head
In a circular linked list, the tail node references the head, enabling round-
robin or repeated traversal patterns .
10. Which operation on a doubly-linked list is more efficient than on a
singly-linked list?
A. Deleting a node when only a reference to that node is available
B. Accessing an element by index
C. Searching for a value
D. Sorting the list
A. Deleting a node when only a reference to that node is available
A doubly-linked list has a previous pointer, allowing deletion without
traversing from the head to find the predecessor .
11. What is the amortized time complexity of appending to a dynamic
array that doubles its capacity when full?