If you were designing a simple hash function for strings, which operation would likely be a core component?
Sorting the characters in the string alphabetically.
Converting characters to their ASCII codes and performing arithmetic operations.
Finding the length of the string.
Reversing the string.
Which of the following is NOT a collision handling technique in hashmaps?
Binary Search
Open Addressing
Separate Chaining
Linear Probing
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 use less memory.
Hashmaps can handle duplicate values more efficiently.
Hashmaps can store sorted data.
What is the purpose of a load factor in a hashmap?
To determine when to resize the hashmap.
To count the number of collisions.
To store the maximum number of key-value pairs.
To measure the efficiency of the hash function.
Which of these is a disadvantage of open addressing compared to separate chaining in hashmaps?
Requires more complex implementation compared to chaining.
Clustering of elements can lead to performance degradation.
Increased memory usage due to linked lists.
Cannot handle a large number of collisions efficiently.
In a symbol table implementation using a hashmap, what do the keys usually represent?
Data types of variables.
Memory addresses of variables.
Values of variables.
Names of variables or identifiers.
What is a significant disadvantage of using a hashmap when you need to retrieve elements in a sorted order?
Hashmaps have high memory consumption.
Hashmaps have slow insertion times.
Hashmaps cannot handle duplicate values.
Hashmaps don't inherently maintain order.
What is a disadvantage of using hashmaps when the number of elements to be stored is not known in advance?
They are less memory-efficient than arrays for storing a fixed number of elements.
They are more complex to implement than linked lists.
They might require resizing, which can be an expensive operation.
They are not suitable for storing data in a sorted order.
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 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 allow duplicate keys.
Hashmaps consume less memory.