/* */ Click to Join Live Class with Shankar sir Call 9798158723

# Data Structure MCQ - Hashing

1. Distinct array position for every possible key
2. Fewer array positions than keys
3. Fewer keys than array positions
4. Same array position for all keys

Explanations :Direct addressing is possible only when we can afford to allocate an array that has one position for every possible key.
Q2.What is a hash function?
1. A function has allocated memory to keys
2. A function that computes the location of the key in the array
3. A function that creates an array
4. A function that computes the location of the values in the array

Explanations :In a hash table, there are fewer array positions than the keys, so the position of the key in the array has to be computed, this is done using the hash function.
Q3. What is simple uniform hashing?
1. Every element has equal probability of hashing into any of the slots
2. A weighted probabilistic method is used to hash elements into the slots
3. Elements has Random probability of hashing into array slots
4. Elements are hashed based on priority

Explanations :In simple uniform hashing, any given element is equally likely to hash into any of the slots available in the array.
Q4.In simple chaining, what data structure is appropriate?
4. Binary trees

Explanations :Deletion becomes easier with doubly linked list, hence it is appropriate.
Q5.What is the search complexity in direct addressing?
1. O(n)
2. O(logn)
3. O(nlogn)
4. O(1)

Explanations :Since every key has a unique array position, searching takes a constant time.
Q6.What is a hash function?
1. A function has allocated memory to keys
2. A function that computes the location of the key in the array
3. A function that creates an array
4. None of the mentioned

Explanations : In a hash table, there are fewer array positions than the keys, so the position of the key in the array has to be computed, this is done using the hash function.
Q7.What is simple uniform hashing?
1. Every element has equal probability of hashing into any of the slots
2. A weighted probabilistic method is used to hash elements into the slots
3. Elements has Random probability of hashing into array slots
4. Elements are hashed based on priority

Explanations :In simple uniform hashing, any given element is equally likely to hash into any of the slots available in the array.
Q8.In simple uniform hashing, what is the search complexity?
1. O(n)
2. O(logn)
3. O(nlogn)
4. O(1)

Explanations :There are two cases, once when the search is successful and when it is unsuccessful, but in both the cases, the complexity is O(1+alpha) where 1 is to compute the hash function and alpha is the load factor.
Q9.What is the advantage of the hash table over a linked list?
1. faster access of data
2. easy to implement
3. very efficient for less number of entries
4. exhibit good locality of reference