1.Easy
What is the main difference between a static array and a dynamic array?
- AA static array can only store numbers
- BA dynamic array can grow by moving to a larger block of memory
- CA dynamic array stores its elements in linked nodes so it can grow one at a time
- DA static array allows slower index access
2.Easy
The depth of a node in a tree is:
- AThe number of nodes in its subtree
- BThe number of edges from that node to the deepest leaf
- CThe number of children of that node
- DThe number of edges from the root to that node
3.Easy
Which data structure is most suitable for the "undo" feature in a text editor?
- AQueue
- BStack
- CGraph
- DHash set
4.Medium
A binary tree has root 1 with left child 2 and right child 3; node 2 has children 4 (left) and 5 (right). What is the postorder traversal?
- A1 2 4 5 3
- B4 5 2 3 1
- C5 4 3 2 1
- D4 2 5 1 3
5.Medium
The keys 50, 30, 70, 20, 40 are inserted in this order into an empty binary search tree. What is the left child of 30?
- A20
- B40
- C50
- D70
6.Medium
A hash table of size 7 uses h(k) = k mod 7 and linear probing. After inserting 10, where is 17 stored?
- AIndex 6
- BIndex 0
- CIndex 4
- DIndex 3
7.Hard
A Bloom filter can answer "is this element in the set?" with:
- AExact answers always
- BAnswers only for numbers
- CPossible false negatives but no false positives
- DPossible false positives but no false negatives
8.Hard
An AVL node is unbalanced because its left child's right subtree became too tall (left-right case). Which fix is applied?
- AA left rotation at the left child, then a right rotation at the node
- BA right rotation at the left child, then a left rotation at the node
- CA single right rotation at the node
- DA single left rotation at the node
Answer key
- 1. B · A dynamic array can grow by moving to a larger block of memory
- 2. D · The number of edges from the root to that node
- 3. B · Stack
- 4. B · 4 5 2 3 1
- 5. A · 20
- 6. C · Index 4
- 7. D · Possible false positives but no false negatives
- 8. A · A left rotation at the left child, then a right rotation at the node
Full step-by-step solutions: practise this topic on examproblems.com.