Questions: Hash Function Design: Properties and Requirements

5 questions to test your understanding

Score: 0 / 5
Question 1 Multiple Choice

You build a hash table for student records using h(k) = birth_year mod 100. Most students were born in 2000–2005, so keys cluster into six buckets while 94 sit empty. What core hash function property does this violate?

ADeterminism — the function produces the same output for the same input
BUniform distribution — a good function spreads keys evenly, but this one creates severe clustering
CThe avalanche effect — changing one bit of a birth year doesn't change the hash much
DComputational efficiency — birth year extraction is too slow to compute
Question 2 Multiple Choice

A security engineer suggests using SHA-256 as the hash function for a high-throughput in-memory hash table storing billions of URL lookups per second. What is the main problem with this choice?

ASHA-256 is not deterministic — it may return different hashes for the same key
BSHA-256 lacks the avalanche effect needed for good distribution in hash tables
CSHA-256 is designed to be computationally expensive to prevent attacks, making it far too slow for hash table use
DSHA-256 cannot handle variable-length keys like URLs
Question 3 True / False

A hash function exhibits the avalanche effect if changing a single bit of the input changes approximately half of the output bits unpredictably.

TTrue
FFalse
Question 4 True / False

Any deterministic function that maps keys to integers in the range [0, m) is a suitable hash function for a hash table, as long as the same key generally produces the same value.

TTrue
FFalse
Question 5 Short Answer

Why might a fast, non-cryptographic hash function like MurmurHash be preferable to SHA-256 for a hash table, even though SHA-256 has stronger collision resistance? Under what circumstances would the choice reverse?

Think about your answer, then reveal below.