Data Structure MCQ - Hashing Function

This section focuses on the "Hashing Function" of the Data Structure. These Multiple Choice Questions (mcq) should be practiced to improve the Data Structure skills required for various interviews (campus interview, walk-in interview, company interview), placement, entrance exam and other competitive examinations.

1. What is a hash table?

A. A structure that maps values to keys
B. A structure that maps keys to values
C. A structure used for storage
D. A structure used to implement stack and queue

View Answer

2. How many different insertion sequences of the key values using the same hash function and linear probing will result in the hash table shown above?

A. 10
B. 20
C. 30
D. 40

View Answer

3. If ' h ' is a hashing function and it is used to hash ' n ' keys into a table of size ' m ' where n <= m . What is the expected number of collisions involving a particular key ' x ' ?

A. less than 1.
B. less than n.
C. less than m.
D. less than n / 2.

View Answer

4.Hashing technique which allocates fixed number of buckets is classified as

A. dynamic hashing
B. static hashing
C. external hashing
D. internal hashing

View Answer

5.If several elements are competing for the same bucket in the hash table, what is it called?

A. Diffusion
B. Replication
C. Collision
D. None of the mentioned

View Answer

6. Consider a hash table of size seven, with starting index zero, and a hash function (3x + 4)mod7. Assuming the hash table is initially empty, which of the following is the contents of the table when the sequence 1, 3, 8, 10 is inserted into the table using closed hashing? Note that ‘_’ denotes an empty location in the table.

A. 8, _, _, _, _, _, 10
B. 1, 8, 10, _, _, _, 3
C. 1, _, _, _, _, _,3
D. 1, 10, 8, _, _, _, 3

View Answer

7. What is the advantage of using a dynamic set in direct addressing?

A. It saves time
B. It saves space
C. It saves both time and space
D. None of the mentioned

View Answer

8. In linear hashing, formula used to calculate number of records if blocking factor, loading factor and file buckets are known is as

A. r =l + bfr + N
B. r =l - bfr - N
C. r =l + bfr - N
D. r =l * bfr * N

View Answer

9. What is the load factor?

A. Average array size
B. Average key size
C. Average chain length
D. None of the mentioned

View Answer

10. Given a hash table T with 25 slots that stores 2000 elements, the load factor α for T is __________

A. 80
B. 0.0125
C. 8000
D. 1.25

View Answer

Also Check :


* You must be logged in to add comment.