Which collision resolution strategy is generally preferred for hash tables with open addressing when the load factor is low?
Quadratic Probing
Separate Chaining
Linear Probing
Double Hashing
When does rehashing typically occur in a hashmap?
Every time a new key is inserted.
When the hashmap is cleared using the clear() method.
When the hash function is modified.
When the load factor exceeds a predetermined threshold.
In the worst-case scenario, what is the time complexity of searching for a key in a hashmap?
O(1)
O(n)
O(log n)
O(n log n)
Which of the following scenarios could potentially lead to collisions in a hashmap?
Having a hash table size much larger than the number of keys being stored
Using a hash function that distributes keys evenly across the hash table
Hashing two different keys to the same index in the hash table
Storing keys with a wide range of values
You are implementing an LRU (Least Recently Used) cache. Which data structure, in conjunction with a hashmap, is most suitable for tracking the usage order of cached items?
Queue
Doubly Linked List
Binary Tree
Stack
How does universal hashing enhance the robustness of hash tables?
By minimizing the impact of hash collisions on retrieval time
By ensuring a uniform distribution of keys across the hash table
By eliminating the possibility of hash collisions entirely
By dynamically adjusting the hash function to the input data
What is the purpose of dynamic resizing (rehashing) in a hashmap?
To maintain a low load factor and prevent performance degradation.
To improve the efficiency of key deletion operations.
To reduce the number of keys stored in the hashmap.
To increase the size of the hash function's output range.
What is a primary disadvantage of using linear probing for collision resolution in a hash table?
Higher memory overhead compared to chaining
Complex implementation
Increased potential for primary clustering
Not suitable for open addressing
Which collision resolution technique involves using a second, independent hash function to compute the probe sequence?
In a web server, which scenario is best suited for using a hashmap to optimize performance?
Storing and retrieving static website content like images and CSS files
Maintaining a log of all incoming requests in chronological order
Managing the order of user connections to ensure fairness
Storing and retrieving user session data