You are implementing an LRU (Least Recently Used) cache with a fixed capacity. Which data structure combination would be most suitable for efficiently managing the cache?
Hashmap + Stack
Hashmap + Doubly Linked List
Array + Queue
Binary Search Tree + Heap
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
Array
Linked list
What is the primary advantage of using a universal hash function?
It eliminates the possibility of collisions entirely.
It makes the hash table resistant to attacks that exploit patterns in the hash function.
It provides better performance than any single, fixed hash function.
It ensures constant-time performance for all operations.
What is a common disadvantage of using a hashmap with a poorly chosen hash function?
Inability to handle duplicate keys
Frequent hash collisions
Increased memory usage
Slow key generation
How does using a cryptographic hash function with a random salt improve the security of a hashmap storing user credentials?
It eliminates the possibility of hash collisions.
It makes it significantly harder for attackers to perform rainbow table attacks.
It encrypts the data stored in the hashmap, making it unreadable without the decryption key.
It prevents unauthorized users from accessing the hashmap's keys.
You are designing a system to store and retrieve frequently accessed data with high performance. Which of the following hash table collision resolution strategies would generally offer the BEST performance under high load factors?
Quadratic Probing
Linear Probing
Separate Chaining
Double Hashing
What is the primary reason for using a prime number as the size of a hash table in many implementations?
To make the implementation of the hash table simpler.
To increase the speed of hash function computation.
To minimize the memory usage of the hash table.
To ensure an even distribution of keys across the hash table, reducing collisions.
How can a hash flooding attack impact the performance of a web server using a hashmap to store session data?
It can lead to increased memory usage and faster response times.
It has no impact on performance, as hash flooding attacks only target data integrity.
It can improve the efficiency of the hashmap by distributing data more evenly.
It can cause a denial-of-service by forcing the server to handle a large number of collisions.
Which collision resolution strategy generally performs better in terms of cache locality?
Both perform equally well
Cache locality is irrelevant to hash tables
Open Addressing
In a hash table using double hashing, the second hash function is used to:
Determine the initial index to store the key.
Determine the step size for probing in case of a collision.
Calculate the size of the hash table.
Generate a new key if a collision occurs.