LogIn
I don't have account.

Practice hashing Quizzes

Enhance your hashing skills with carefully curated quizzes designed to improve concept clarity and real-world application. Each question reinforces key principles through active practice. Ideal for students and professionals, these quizzes help you learn faster, stay sharp and strengthen your overall technical expertise.

Explore All hashing Quizzes

Learn hashing step by step with interactive quizzes designed for beginners and learners revising key concepts. Build a strong foundation with clear, structured practice in hashing.
Question 1
Which of the following properties is essential for a good hash function?
1
It should generate the same hash for different inputs
2
It must produce only prime numbers
3
It should distribute keys uniformly
4
It must be slow to compute
Question 2
What is a "collision" in hashing?
1
When a hash function fails to generate a unique key
2
When two hash functions produce the same output
3
When two different inputs produce the same hash value
4
When a hash table runs out of space
Question 3
Which of the following is NOT a collision resolution technique?
1
Separate Chaining
2
Quick Sorting
3
Linear Probing
4
Double Hashing
Question 4
In open addressing, which of the following techniques involves checking the next available slot sequentially?
1
Separate Chaining
2
Quadratic Probing
3
Linear Probing
4
Double Hashing
Question 5
Which hash function is commonly used for cryptographic applications?
1
MD5
2
SHA-256
3
CRC32
4
All of the above
Question 6
Which of the following is NOT a property of a cryptographic hash function?
1
Avalanche effect
2
Pre-image resistance
3
Deterministic output
4
Fast reversibility
Question 7
Which of the following best describes hashing?
1
A method for encrypting data securely
2
A method to convert data into a fixed-size value for fast retrieval
3
A technique to sort data efficiently
4
A method for compressing data
Question 8
Double hashing uses
1
Two hash functions to compute probe sequences
2
A hash and an encryption function
3
Two keys for one value
4
Two hash tables
Question 9
If the hash table size is m, which of the following ensures minimal collisions?
1
Choosing m as a multiple of 10
2
Choosing m as a prime number
3
Choosing m as an even number
4
Choosing m equal to 2ⁿ
Question 10
In open addressing, primary clustering occurs mostly in which probing method?
1
Linear probing
2
Quadratic probing
3
Double hashing
4
Separate chaining
Question 11
Which hashing scheme uses a random choice of hash function from a family to ensure good average performance regardless of the input?
1
Division method
2
Multiplication method
3
Open addressing
4
Universal hashing
Question 12
What is the expected time complexity of search in a well-distributed hash table using chaining with load factor α = n/m?
1
O(α²)
2
O(log n)
3
O(1 + α)
4
O(n)
Question 13
In open-address hashing using linear probing, what issue is most responsible for performance degradation as load factor increases?
1
Primary clustering
2
Coalesced chaining
3
Double hashing
4
Secondary clustering
Question 14
Which of the following is not a desirable property of a good hash function?
1
Distributes keys uniformly
2
Easy to compute
3
Minimizes collisions
4
Produces sequential contiguous values for similar keys
Question 15
Given a hash table of size 7 and keys inserted: {9, 4, 17, 24} using h(k) = k mod 7 and linear probing for collisions, what is the resulting slot index of key 24?
1
4
2
3
3
5
4
6
Question 16
What is the load factor α of a hash table and why is it important?
1
α = n/m, it measures number of keys per slot and influences performance
2
α = m/n, it measures table size ratio to number of keys
3
α = n×m, it measures overall memory usage
4
α = number of collisions divided by m
Question 17
What is the best hashing function characteristic for a HashMap?
1
It should work only for numbers.
2
It should minimize collisions and distribute keys uniformly.
3
It should always return the same value.
4
It should generate the same hash for similar values.
Question 18
What is the impact of using a poor hash function in a HashMap?
1
The HashMap will throw an exception
2
More collisions, leading to performance degradation
3
Increased memory consumption
4
Faster lookup times
Question 19
What is the recommended load factor for optimal performance in a Java HashMap?
1
0.75
2
1
3
0.9
4
0.7
Question 20
What happens if two different keys have the same hash code in a HashMap?
1
The second key-value pair replaces the first.
2
The keys are ignored.
3
The HashMap throws an exception.
4
Both key-value pairs are stored in the same bucket using chaining or tree-based storage.
Question 21
Which of the following statements is true about Java HashMap’s key lookup process?
1
HashMap sorts keys before performing lookup.
2
HashMap checks hashCode() first, then uses equals() to confirm key identity.
3
HashMap uses a binary search algorithm for lookups.
4
The key lookup is always O(1).
Question 22
What is the main advantage of using a perfect hash function?
1
It allows duplicate keys in HashMap.
2
It automatically resizes the HashMap.
3
It reduces memory usage significantly.
4
It ensures no collisions occur.
Question 23
Which technique is used in distributed key-value stores to distribute keys across multiple nodes efficiently?
1
Consistent Hashing
2
Chaining
3
Bloom Filters
4
Hash Code Modulo
Question 24
What is "load factor" in a hash table?
1
The percentage of non-empty slots in a hash table
2
The time taken to insert an element
3
The maximum number of elements allowed in a hash table
4
The ratio of occupied slots to the total capacity
Question 25
Which technique is used to distribute keys across nodes in distributed key-value stores?
1
Binary Search
2
Bloom Filters
3
Chaining
4
Consistent Hashing