Which of the following data structures is commonly used to implement a hashmap?
Tree
Linked List
Graph
Array
You want to update the value associated with a key in a hashmap. What is the general process involved?
Hashmaps do not support value updates; you need to create a new hashmap.
Search for the key sequentially, and update the value when found.
Calculate the hash of the key, find the corresponding bucket, and directly modify the value.
Delete the existing key-value pair, then insert a new one with the updated value.
How are dictionaries typically implemented in programming languages?
Using linked lists for fast insertions.
Using arrays for efficient indexing.
Using hashmaps to provide fast key-value lookups.
Using binary trees for sorted key storage.
What does a hashmap store data in?
Binary Tree
Key-Value Pairs
Sorted Array
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.
Reversing the string.
Finding the length of the string.
Converting characters to their ASCII codes and performing arithmetic operations.
Which of the following is NOT a collision handling technique in hashmaps?
Open Addressing
Separate Chaining
Binary Search
Linear Probing
What is a disadvantage of using a hashmap?
Inability to handle collisions.
Cannot iterate over elements in a specific order.
Keys must be immutable.
Slow search speed.
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 the primary role of the modulo operator (%) in simple hash functions?
To handle collisions effectively.
To sort keys in ascending order based on their hash values.
To map the hash code to a valid index within the array's bounds.
To generate a unique hash code for each key.
Which characteristic of a hash function is undesirable and can lead to performance degradation?
High Collision Rate
Fast Computation
Uniform Distribution
Deterministic