1.Easy
What is the name of the stack operation that adds an element to the top?
- APop
- BPush
- CPeek
- DEnqueue
2.Easy
In which order does a preorder traversal of a binary tree visit nodes?
- ALevel by level from the top
- BLeft subtree, then right subtree, then node
- CNode, then left subtree, then right subtree
- DLeft subtree, then node, then right subtree
3.Easy
What is the load factor of a hash table?
- AThe number of collisions so far
- BThe number of buckets divided by the average length of the keys stored
- CThe time needed to load the table from disk
- DThe number of stored elements divided by the number of buckets
4.Medium
How is a new element inserted into a binary heap?
- APlace it at the end of the array and sift it up while it violates the heap property
- BInsert it at its sorted position by shifting all of the larger elements one place right
- CPlace it at the root and sift it down
- DRebuild the whole heap from scratch
5.Medium
An in-order traversal of a binary search tree visits the keys in:
- ALevel order
- BDescending order always
- CAscending sorted order
- DInsertion order
6.Medium
In a circular queue stored in an array of capacity n, how is the next position after index i computed?
- A(i − 1) mod n
- Bi + 1
- C(i + 1) mod n
- D2i + 1
7.Hard
Why can elements not simply be deleted from a standard Bloom filter by clearing their bits?
- ABits in a Bloom filter cannot be changed after creation
- BDeleting would increase the false positive rate to 100%
- CThose bits may also belong to other elements, which would cause false negatives
- DBloom filters store the full elements, and these cannot be located again once hashed
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 right rotation at the left child, then a left rotation at the node
- BA left rotation at the left child, then a right rotation at the node
- CA single left rotation at the node
- DA single right rotation at the node
Answer key
- 1. B · Push
- 2. C · Node, then left subtree, then right subtree
- 3. D · The number of stored elements divided by the number of buckets
- 4. A · Place it at the end of the array and sift it up while it violates the heap property
- 5. C · Ascending sorted order
- 6. C · (i + 1) mod n
- 7. C · Those bits may also belong to other elements, which would cause false negatives
- 8. B · 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.