1.Easy
What is the load factor of a hash table?
- AThe number of buckets divided by the average length of the keys stored
- BThe number of stored elements divided by the number of buckets
- CThe number of collisions so far
- DThe time needed to load the table from disk
2.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 static array allows slower index access
- DA dynamic array stores its elements in linked nodes so it can grow one at a time
3.Easy
What is a weighted graph?
- AA graph that is stored on disk
- BA graph with more edges than vertices
- CA graph in which some vertices are heavier than others because they have more edges
- DA graph in which each edge has a numeric value such as a cost or distance
4.Medium
A trie (prefix tree) is especially efficient for:
- APrefix searches such as autocomplete
- BFinding shortest paths
- CStoring matrices
- DSorting numbers
5.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
- B2i + 1
- C(i − 1) mod n
- Di + 1
6.Medium
How long does a search for a word of length L take in a trie with a fixed alphabet?
- AO(n), where n is the number of words
- BO(L), independent of how many words are stored
- CO(L × n)
- DO(log n), where n is the number of words
7.Hard
Under simple uniform hashing, what is the expected time of a search in a hash table with chaining, n keys and m buckets?
- AO(m)
- BO(log n)
- CO(n)
- DO(1 + α), where α = n / m
8.Hard
In a circular buffer, front == rear can mean either empty or full. What is a common way to tell them apart?
- AAlways clear the buffer whenever front equals rear, so the state is empty
- BKeep a separate element count, or always leave one slot unused
- CStore the front and rear in the same variable
- DMake the buffer size a power of two
Answer key
- 1. B · The number of stored elements divided by the number of buckets
- 2. B · A dynamic array can grow by moving to a larger block of memory
- 3. D · A graph in which each edge has a numeric value such as a cost or distance
- 4. A · Prefix searches such as autocomplete
- 5. A · (i + 1) mod n
- 6. B · O(L), independent of how many words are stored
- 7. D · O(1 + α), where α = n / m
- 8. B · Keep a separate element count, or always leave one slot unused
Full step-by-step solutions: practise this topic on examproblems.com.