1.Easy
Which data structure is used to perform a level-order traversal of a tree?
- AHash table
- BQueue
- CPriority queue
- DStack
2.Easy
In a singly linked list, what does the next pointer of the last node contain?
- AThe address of the first node
- BThe address of the previous node
- CThe number of nodes in the list
- DNull (no node)
3.Easy
In an adjacency list representation of a graph, what is stored for each vertex?
- AA row of V Boolean values
- BThe total number of edges in the graph
- CThe shortest path to every other vertex
- DA list of its neighbouring vertices
4.Medium
Why can a binary heap be stored in an array without any pointers?
- AAll keys in a heap are equal
- BArrays automatically keep the keys in sorted order, so no pointers are needed
- CIt is a complete binary tree, so positions follow simple index formulas
- DHeaps never contain more than 100 elements
5.Medium
Which data structure is used by depth-first search (iterative version)?
- AA stack
- BA queue
- CA hash table only
- DA heap
6.Medium
In a binary heap stored in an array starting at index 0, where is the parent of the node at index i?
- AAt index ⌊(i − 1) / 2⌋
- BAt index i − 1
- CAt index 2i + 1
- DAt index ⌊i / 2⌋ + 1
7.Hard
Why might a server choose its hash function at random from a universal family?
- ATo guarantee that no two keys can ever collide, whatever keys an attacker sends
- BTo make it very unlikely that an attacker can pick many keys that all collide
- CTo make the hash table sorted
- DTo remove the need to resize the table
8.Hard
Which pair of traversals always determines a unique binary tree with distinct keys?
- APreorder and inorder
- BLevel-order alone
- CPreorder alone
- DPreorder and postorder
Answer key
- 1. B · Queue
- 2. D · Null (no node)
- 3. D · A list of its neighbouring vertices
- 4. C · It is a complete binary tree, so positions follow simple index formulas
- 5. A · A stack
- 6. A · At index ⌊(i − 1) / 2⌋
- 7. B · To make it very unlikely that an attacker can pick many keys that all collide
- 8. A · Preorder and inorder
Full step-by-step solutions: practise this topic on examproblems.com.