Practice 20 Hashing multiple-choice questions designed for CDAC CCAT exam preparation. Click "Show Answer" to reveal the correct option with detailed explanation.
Show Answer & Explanation
Correct Answer: A — O(1)
Hash table provides O(1) average case for insert, delete, search.
Show Answer & Explanation
Correct Answer: B — Two keys map to same index
Collision occurs when different keys produce the same hash index.
Show Answer & Explanation
Correct Answer: B — Checking next slot sequentially
Linear probing checks next consecutive slots until empty slot found.
Show Answer & Explanation
Correct Answer: B — Linked lists at each index
Chaining stores multiple elements at same index using linked list.
Show Answer & Explanation
Correct Answer: A — n/m
Load factor = n/m where n is elements and m is table size.
Show Answer & Explanation
Correct Answer: B — Distribute keys uniformly
Good hash function distributes keys uniformly to minimize collisions.
Show Answer & Explanation
Correct Answer: B — O(n)
Worst case (all keys collide) is O(n).
Show Answer & Explanation
Correct Answer: B — Two hash functions
Double hashing uses two hash functions to calculate probe sequence.
Show Answer & Explanation
Correct Answer: D — Sorting
Sorting is not a collision resolution technique.
Show Answer & Explanation
Correct Answer: B — Linear probing
Linear probing suffers from primary clustering where consecutive slots fill up.
Show Answer & Explanation
Correct Answer: C — Quadratic probing
Quadratic probing suffers from secondary clustering where keys with same hash follow same probe sequence.
Show Answer & Explanation
Correct Answer: B — Load factor exceeds threshold
Rehashing creates a larger table when load factor becomes too high to maintain efficiency.
Show Answer & Explanation
Correct Answer: B — Prime number
Prime number table sizes help distribute keys more uniformly and reduce collisions.
Show Answer & Explanation
Correct Answer: B — Adversarial attacks
Universal hashing randomly selects hash function to prevent adversarial worst-case inputs.
Show Answer & Explanation
Correct Answer: B — Two hash functions and tables
Cuckoo hashing uses two hash functions and moves elements between positions on collision.
Show Answer & Explanation
Correct Answer: B — O(1) worst case lookup
Perfect hashing provides O(1) worst-case lookup with no collisions for static sets.
Show Answer & Explanation
Correct Answer: B — Tombstone/Deleted
Tombstone markers allow probe sequences to continue past deleted elements.
Show Answer & Explanation
Correct Answer: B — 7
47 mod 10 = 7, so the key 47 maps to index 7.
Show Answer & Explanation
Correct Answer: B — Load factor can exceed 1
With chaining, load factor can exceed 1 as multiple elements can be at same index.
Show Answer & Explanation
Correct Answer: B — Probabilistic membership testing
Bloom filter is a space-efficient probabilistic structure for membership testing with possible false positives.