In cuckoo hashing, how many hash functions are typically used?
2
1
It depends on the size of the hash table.
3
In a hash table using double hashing, the second hash function is used to:
Determine the initial index to store the key.
Generate a new key if a collision occurs.
Determine the step size for probing in case of a collision.
Calculate the size of the hash table.
How does using a cryptographic hash function with a random salt improve the security of a hashmap storing user credentials?
It encrypts the data stored in the hashmap, making it unreadable without the decryption key.
It eliminates the possibility of hash collisions.
It makes it significantly harder for attackers to perform rainbow table attacks.
It prevents unauthorized users from accessing the hashmap's keys.
Why is it generally recommended to avoid using mutable objects as keys in hash tables?
Using mutable keys increases the memory overhead of the hash table.
Mutable keys can lead to inconsistent state if their values are modified after being inserted into the hash table.
Hash tables cannot store mutable objects as keys; only immutable objects are allowed.
Mutable keys make the implementation of the hash table significantly more complex.
What security risk arises from storing sensitive data like passwords directly in a hashmap, even when hashed?
Storing any data in a hashmap increases the risk of SQL injection attacks.
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.
What is a common disadvantage of using a hashmap with a poorly chosen hash function?
Inability to handle duplicate keys
Increased memory usage
Slow key generation
Frequent hash collisions
Which of these data structures can provide a more secure and performant alternative to a hashmap when handling user authentication data, especially in scenarios prone to hash flooding attacks?
Tree
Queue
Linked list
Array
What mechanism does Java's ConcurrentHashMap employ to allow for concurrent reads and updates while maintaining thread safety?
Read-write locks separating readers and writers
Lock-free data structures using atomic operations
A single global lock for all operations
Fine-grained locking at the bucket level
Which of these statements best describes the advantage of using a perfect hash function over a regular hash function?
It allows for faster key insertions.
It guarantees constant-time search, insertion, and deletion in the worst case.
It reduces the memory used by the hash table.
It eliminates the need for collision handling.
In a hashmap implementation using open addressing with linear probing, what is the worst-case time complexity for searching for a key if the hash table is nearly full?
O(1)
O(log n)
O(n)
O(n log n)