Hopscotch hashing aims to improve the performance of open addressing by:
Limiting the maximum distance a key can be placed from its original hash index.
Employing a binary search tree for efficient collision resolution.
Using multiple hash tables to store keys with different hash values.
Using a dynamic array to resize the table when the load factor gets high.
In the context of hash tables, what does a high load factor indicate?
Lower memory usage.
A higher probability of collisions.
Faster insertion operations.
A more efficient hash function is being used.
What security risk arises from storing sensitive data like passwords directly in a hashmap, even when hashed?
An attacker gaining access to the hashmap could retrieve the plaintext passwords.
Hashmaps are inherently less secure than other data structures for storing passwords.
Hash collisions could allow attackers to bypass authentication.
Storing any data in a hashmap increases the risk of SQL injection attacks.
Why is it generally recommended to avoid using mutable objects as keys in hash tables?
Mutable keys make the implementation of the hash table significantly more complex.
Using mutable keys increases the memory overhead of the hash table.
Hash tables cannot store mutable objects as keys; only immutable objects are allowed.
Mutable keys can lead to inconsistent state if their values are modified after being inserted into the hash table.
What is the primary advantage of using a universal hash function?
It provides better performance than any single, fixed hash function.
It ensures constant-time performance for all operations.
It eliminates the possibility of collisions entirely.
It makes the hash table resistant to attacks that exploit patterns in the hash function.
What is the primary reason for using a prime number as the size of a hash table in many implementations?
To increase the speed of hash function computation.
To make the implementation of the hash table simpler.
To minimize the memory usage of the hash table.
To ensure an even distribution of keys across the hash table, reducing collisions.
Which collision resolution strategy generally performs better in terms of cache locality?
Open Addressing
Cache locality is irrelevant to hash tables
Separate Chaining
Both perform equally well
Python dictionaries use open addressing for collision resolution. Which of the following techniques helps mitigate the performance degradation caused by clustering in open addressing?
Using a cryptographic hash function
Robin Hood Hashing
Linear Probing with a prime step size
Which of the following is NOT a valid mitigation strategy against hash flooding attacks?
Switching to a different data structure like a tree-based map that offers consistent performance.
Employing a bloom filter to quickly identify and discard potentially malicious input.
Using a fixed-size hashmap to limit the maximum number of collisions.
Implementing a random salt value in the hash function to make collisions unpredictable.
Which of the following statements accurately describes a key difference in the behavior of Python dictionaries and Java HashMaps?
Java HashMaps allow null keys and values, while Python dictionaries do not.
Python dictionaries use separate chaining for collision resolution, while Java HashMaps employ open addressing.
Java HashMaps are synchronized and thread-safe, whereas Python dictionaries are not.
Python dictionaries maintain insertion order, while Java HashMaps do not guarantee any specific order.