1.Easy
What is the name of the queue operation that removes the element at the front?
- AEnqueue
- BInsert
- CPush
- DDequeue
2.Easy
What does the peek (or top) operation on a stack do?
- ARemoves the top element and returns it
- BReturns the bottom element of the stack
- CReturns the top element without removing it
- DRemoves all elements from the stack
3.Easy
What is the name of the stack operation that adds an element to the top?
- AEnqueue
- BPeek
- CPop
- DPush
4.Medium
In a hash table using open addressing, what is the maximum possible load factor?
- AThere is no maximum
- B1
- C2
- D0.5
5.Medium
A node in a binary search tree has a right subtree. Where is its in-order successor?
- AIts right child, always
- BThe rightmost node of its left subtree
- CIts parent, always
- DThe leftmost node of its right subtree
6.Medium
Which data structure is used by depth-first search (iterative version)?
- AA stack
- BA heap
- CA queue
- DA hash table only
7.Hard
Why might a server choose its hash function at random from a universal family?
- ATo make the hash table sorted
- BTo remove the need to resize the table
- CTo make it very unlikely that an attacker can pick many keys that all collide
- DTo guarantee that no two keys can ever collide, whatever keys an attacker sends
8.Hard
A Fenwick tree (binary indexed tree) over an array of n numbers supports which operations in O(log n)?
- AFinding the median in O(1)
- BInserting elements at any position
- CPrefix-sum queries and single-element updates
- DSorting the array and binary search
Answer key
- 1. D · Dequeue
- 2. C · Returns the top element without removing it
- 3. D · Push
- 4. B · 1
- 5. D · The leftmost node of its right subtree
- 6. A · A stack
- 7. C · To make it very unlikely that an attacker can pick many keys that all collide
- 8. C · Prefix-sum queries and single-element updates
Full step-by-step solutions: practise this topic on examproblems.com.