Which of the following is NOT a typical operation supported by hashmaps?
Delete
Insert
Search
Sort
What is a disadvantage of using hashmaps when the number of elements to be stored is not known in advance?
They might require resizing, which can be an expensive operation.
They are less memory-efficient than arrays for storing a fixed number of elements.
They are not suitable for storing data in a sorted order.
They are more complex to implement than linked lists.
What is a key advantage of using a hashmap over a sorted array for searching?
Hashmaps maintain data in sorted order.
Hashmaps offer faster search on average.
Hashmaps consume less memory.
Hashmaps allow duplicate keys.
What is a disadvantage of using a hashmap?
Slow search speed.
Keys must be immutable.
Inability to handle collisions.
Cannot iterate over elements in a specific order.
What happens when a hash function produces the same index for different keys?
The hash function is automatically updated.
The hashmap raises an error.
The key-value pair is discarded.
A collision occurs.
You want to update the value associated with a key in a hashmap. What is the general process involved?
Search for the key sequentially, and update the value when found.
Delete the existing key-value pair, then insert a new one with the updated value.
Calculate the hash of the key, find the corresponding bucket, and directly modify the value.
Hashmaps do not support value updates; you need to create a new hashmap.
Which of these is NOT a desirable property of a good hash function?
It should minimize collisions as much as possible.
It should be deterministic (same input always yields the same output).
It should distribute keys uniformly across the hash table.
It should be computationally expensive to calculate.
What is the purpose of a load factor in a hashmap?
To determine when to resize the hashmap.
To measure the efficiency of the hash function.
To store the maximum number of key-value pairs.
To count the number of collisions.
What is the primary advantage of using a hashmap over a linear search in an array when searching for a specific value?
Hashmaps offer faster search times on average.
Hashmaps can store sorted data.
Hashmaps can handle duplicate values more efficiently.
Hashmaps use less memory.
What is linear probing in the context of open addressing for collision resolution?
Resizing the hash table to accommodate more elements.
Probing for an empty slot by sequentially searching from the collision index.
Using a different hash function to avoid collisions.
Using a linked list to store colliding elements at the same index.