1.Easy
What is the defining feature of a set as an abstract data type?
- AIt allows access only at one end
- BIt stores key-value pairs
- CIt stores elements in sorted order
- DIt stores elements without duplicates
2.Easy
Which operation is slow in an array but fast at the head of a linked list?
- AFinding the length of a fixed array
- BReading the last element by index
- CAccessing the 5th element
- DInserting at the beginning
3.Easy
What is a deque (double-ended queue)?
- ATwo separate queues sharing one array
- BA queue that only allows removal at the back
- CA structure that allows insertion and removal at both ends
- DA queue sorted by priority
4.Medium
In a hash table using open addressing, what is the maximum possible load factor?
- AThere is no maximum
- B0.5
- C2
- D1
5.Medium
What happens when a hash table rehashes after its load factor exceeds a threshold?
- AThe existing keys are sorted in place
- BA larger table is allocated and every key is inserted again
- COnly the colliding keys are moved to a new overflow list at the end of the table
- DThe oldest keys are deleted to make room
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 2i + 1
- CAt index i − 1
- DAt index ⌊i / 2⌋ + 1
7.Hard
For a hash table to work correctly, which rule must hash and equality follow?
- AHash values must be prime numbers
- BEqual keys must have equal hash values
- CDifferent keys must have different hash values
- DEqual hash values imply equal keys
8.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 remove the need to resize the table
- DTo make the hash table sorted
Answer key
- 1. D · It stores elements without duplicates
- 2. D · Inserting at the beginning
- 3. C · A structure that allows insertion and removal at both ends
- 4. D · 1
- 5. B · A larger table is allocated and every key is inserted again
- 6. A · At index ⌊(i − 1) / 2⌋
- 7. B · Equal keys must have equal hash values
- 8. B · To make it very unlikely that an attacker can pick many keys that all collide
Full step-by-step solutions: practise this topic on examproblems.com.