1.Easy
What is the name of the stack operation that adds an element to the top?
- AEnqueue
- BPush
- CPeek
- DPop
2.Easy
What is a deque (double-ended queue)?
- AA queue that only allows removal at the back
- BTwo separate queues sharing one array
- CA queue sorted by priority
- DA structure that allows insertion and removal at both ends
3.Easy
In an adjacency list representation of a graph, what is stored for each vertex?
- AThe shortest path to every other vertex
- BThe total number of edges in the graph
- CA list of its neighbouring vertices
- DA row of V Boolean values
4.Medium
Why can a binary heap be stored in an array without any pointers?
- AAll keys in a heap are equal
- BIt is a complete binary tree, so positions follow simple index formulas
- CHeaps never contain more than 100 elements
- DArrays automatically keep the keys in sorted order, so no pointers are needed
5.Medium
What is the worst-case height of a binary search tree with n nodes if keys are inserted in sorted order?
- A√n
- Bn (it becomes a linked list)
- C1
- Dlog₂ n
6.Medium
A circular buffer (ring buffer) is commonly used to implement:
- AA binary search tree
- BA fixed-size queue
- CA hash function
- DA graph traversal
7.Hard
How can you detect whether a singly linked list contains a cycle using O(1) extra memory?
- ACount the nodes until the count exceeds the list length field
- BMove one pointer by one step and another by two steps and check whether they meet
- CSort the list and look for duplicates
- DStore every visited node in a hash set
8.Hard
What does a splay tree do after each access?
- ARebuilds the whole tree in balanced form
- BRotates the accessed node up to the root
- CRecolours the nodes on the search path
- DMoves the accessed node to a leaf
Answer key
- 1. B · Push
- 2. D · A structure that allows insertion and removal at both ends
- 3. C · A list of its neighbouring vertices
- 4. B · It is a complete binary tree, so positions follow simple index formulas
- 5. B · n (it becomes a linked list)
- 6. B · A fixed-size queue
- 7. B · Move one pointer by one step and another by two steps and check whether they meet
- 8. B · Rotates the accessed node up to the root
Full step-by-step solutions: practise this topic on examproblems.com.