Hashing MCQ Quiz in தமிழ் - Objective Question with Answer for Hashing - இலவச PDF ஐப் பதிவிறக்கவும்

Last updated on Mar 30, 2025

பெறு Hashing பதில்கள் மற்றும் விரிவான தீர்வுகளுடன் கூடிய பல தேர்வு கேள்விகள் (MCQ வினாடிவினா). இவற்றை இலவசமாகப் பதிவிறக்கவும் Hashing MCQ வினாடி வினா Pdf மற்றும் வங்கி, SSC, ரயில்வே, UPSC, மாநில PSC போன்ற உங்களின் வரவிருக்கும் தேர்வுகளுக்குத் தயாராகுங்கள்.

Latest Hashing MCQ Objective Questions

Top Hashing MCQ Objective Questions

Hashing Question 1:

Consider a hash table with 10 slots and the collisions are resolved by linear probing. The following keys are inserted in the order: 15, 2, 1, 5, 20, 31, 12, 21, 17, 34.

The hash function is ℎ(k) = k mod 10. The hash table state will be, 

  1. Array-1
  2. Array-1 (1)

  3.  Array-1 (2)

  4. Array-1 (3)

Answer (Detailed Solution Below)

Option 3 :

 Array-1 (2)

Hashing Question 1 Detailed Solution

The correct option is 

Array-1 (2)

EXPLANATION:

Keys: 15, 2, 1, 5, 20, 31, 12, 21, 17, 34.

Hash function ℎ(k) = k mod 10

Insert 15:

ℎ(15) = 15 mod 10 = 5

               15            

   0    1     2     3     4         5        6     7     8     9

Insert 2:

ℎ(2) = 2 mod 10 = 2

      2       15            

   0    1      2     3     4         5        6     7     8     9

Insert 1:

ℎ(1) = 1 mod 10 = 1

   1 2       15            

   0    1      2     3     4         5        6     7     8     9

Insert 5:

ℎ(5) = 5 mod 10 = 5

That will result in a collision at index 5 as it already contains an element. 

So according to linear probing ℎ(k) = k mod 10 + i, where i is the collision number

Now ℎ(5) = 5 mod 10 + 1 = 5 + 1 = 6  

   1 2       15 5         

   0    1      2     3     4         5       6     7     8     9

Insert 20:

ℎ(20) = 20 mod 10 = 0

20 1 2       15            

   0         1     2    3     4       5        6     7    8     9

Insert 31:

ℎ(31) = 31 mod 10 = 1

That will result in a collision at index 1 as it already contains an element. 

So according to linear probing ℎ(k) = k mod 10 + i, where i is the collision number

Now ℎ(31) = 31 mod 10 + 1 = 1 + 1 = 2 which also results into collision.

Now ℎ(31) = 31 mod 10 + 2 = 1 + 2 = 3  

20 1 2 31    15         

   0        1     2     3       4       5      6     7     8    9

Insert 12:

ℎ(12) = 12 mod 10 = 2

That will result in a collision at index 2 as it already contains an element. 

So according to linear probing ℎ(k) = k mod 10 + i, where i is the collision number

Now ℎ(12) = 12 mod 10 + 1 = 2 + 1 = 3 which also results into collision.

Now ℎ(12) = 12 mod 10 + 2 = 2 + 2 = 4  

20 31 12 15 5              

   0      1    2      3       4       5       6     7     8     9

Insert 21:

ℎ(21) = 21 mod 10 = 1

That will result in a collision at index 1 as it already contains an element. 

So according to linear probing ℎ(k) = k mod 10 + i, where i is the collision number

Now ℎ(21) = 21 mod 10 + 1 = 1 + 1 = 2 which also results into collision.

Now ℎ(21) = 21 mod 10 + 2 = 1 + 2 = 3 which also results into collision.

Now ℎ(21) = 21 mod 10 + 2 = 1 + 3 = 4 which also results into collision.

Now ℎ(21) = 21 mod 10 + 2 = 1 + 4 = 5 which also results into collision.

Now ℎ(21) = 21 mod 10 + 2 = 1 + 5 = 6 which also results into collision.

Now ℎ(21) = 21 mod 10 + 2 = 1 + 6 = 7  

20 31 12 15 5   21         

   0     1    2     3      4       5     6       7      8     9 

Insert 17:

ℎ(17) = 17 mod 10 = 7

That will result in a collision at index 7 as it already contains an element. 

So according to linear probing ℎ(k) = k mod 10 + i, where i is the collision number

Now ℎ(17) = 17 mod 10 + 1 = 7 + 1 = 8  

 

20 31 12 15 5   21 17     

   0     1    2     3      4       5     6       7      8     9 

Insert 34:

ℎ(34) = 34 mod 10 = 4

That will result in a collision at index 4 as it already contains an element. 

So according to linear probing ℎ(k) = k mod 10 + i, where i is the collision number

Now ℎ(34) = 34 mod 10 + 1 = 4 + 1 = 5 which also results into collision.

Now ℎ(34) = 34 mod 10 + 2 = 4 + 2 = 6 which also results into collision.

Now ℎ(34) = 34 mod 10 + 2 = 4 + 3 = 7 which also results into collision.

Now ℎ(34) = 34 mod 10 + 2 = 4 + 4 = 8 which also results into collision.

Now ℎ(34) = 34 mod 10 + 2 = 4 + 5 = 9  

 

20 31 12 15 21 17 34

   0     1     2    3       4       5    6     7        8      9

Hashing Question 2:

A _______ is an ordered collection of finite, homogeneous data elements.

  1. Linked List
  2. Graph
  3. Tree
  4. Hash Table
  5. Structure

Answer (Detailed Solution Below)

Option 4 : Hash Table

Hashing Question 2 Detailed Solution

Concept:

Homogeneous data structure (HDS):

  • HDS that contains only similar type of data like only integers or only float values.
  • Basic example of Homogeneous data structure is Array.


Explanation

In question we required ordered finite HDS which is nothing but Array but Array is not present in the

Options so we have to choose best option among them Let’s take option wise.

Option 1:  Linked list

Linked list is HDS but not finite because linked list size is decided on Run time.

Option 2: Graph

Graph is HDS but not finite because Graph size is decided on Run time.

Option 3:  Tree

Tree is HDS but not finite because Tree size is decided on Run time.

Option 4:  Hash Table

Hash table is ordered and finite data structure (Size is decided on Compile time ).

Option 5 : Structure

Structure allows to combine data of different types together. It is finite set of values

Hence option 4 is the Best option to choose for the answer.

Hashing Question 3:

Consider a hash table of size m = 100 and a corresponding hash function h(k) = \(\lfloor{m(kA\text{ mod1})}\rfloor\) for A = \(\frac{\sqrt7}{2}\). Compute the location to which the key 55 is mapped.

Answer (Detailed Solution Below) 75

Hashing Question 3 Detailed Solution

\((kA\text{ mod1})\) means fractional part of \(kA\). i.e. \(kA - \lfloor{kA}\rfloor\)

Here, k = 55, A = \(\frac{\sqrt7}{2}\)

h(k) = \(m\times(kA - \lfloor{kA}\rfloor)\) = 100 \(\times\) (72.75 – 72) = 100 \(\times\) 0.75 = 75

Hashing Question 4:

Consider an open-address hash table with uniform hashing. Give upper bounds on the expected number of probes in an unsuccessful search when the load factor is \(\frac{5}{6}\).

Answer (Detailed Solution Below) 6

Hashing Question 4 Detailed Solution

Given an open-address hash table with load factor, \(\alpha =\frac{n}{m}\) < 1, the expected number of probes in an unsuccessful search is at most \(\frac{1}{(1-\alpha)}\), assuming uniform hashing.

Where m = Number of slots in the hash table and n = Number of keys to be inserted in the hash table.

Therefore, expected number of probes in an unsuccessful search = \(\frac{1}{(1-\alpha)}\) = \(\frac{1}{(1-\frac{5}{6})}\) = 6

Hashing Question 5:

Consider the following elements:

15, 105, 37, 50, 63, 131, 8, 34, 205, 405, 5 and Hash table size = 13

How many collisions occur when these key’s are first folded by adding their digits together and then reducing to mod hash table size.

  1. 5
  2. 4
  3. 3
  4. 2

Answer (Detailed Solution Below)

Option 1 : 5

Hashing Question 5 Detailed Solution

Answer: Option 1

Explanation:

Key

After Folding Location Collision
15 6 6  
105 6 6 Yes
37 10 10  
50 5 5  
63 9 9  
131 5 5 Yes
8 8 8  
34 7 7  
205 7 7 Yes
405 9 9 Yes
5 5 5 Yes

 

Therefore, the number of collisions is 5.

Hashing Question 6:

Using division method [n(k) = k mod m)], at which position 177 and 197 key values are stored in hash table when the size of hash table is 57?

  1. 26, 6
  2. 27, 7
  3. 6, 26
  4. 7, 27

Answer (Detailed Solution Below)

Option 3 : 6, 26

Hashing Question 6 Detailed Solution

Key Points

Concept:

Division Method:

This is the easiest method to create a hash function. The hash function can be described as

 h(k) = k mod n

Here, h(k) is the hash value obtained by dividing the key-value k by the size of hash table n using the remainder. It is best that n is a prime number as that makes sure the keys are distributed with more uniformity. So here mod operation gives a reminder of k and m.

Explanation:

57 × 1 = 57

57 × 2 = 114

57 × 3 = 171

So both are close to 171,

171 + 6 = 177

171 + 26 = 197

 h(177) = 177 mod 57 = 6

 h(197) = 197 mod 57 = 26

positions are 6, 26 of 177 and 197 respectivly.

Hence the correct answer is 6, 26.

Hashing Question 7:

Consider an empty Hash table of size 13 (0 -12). The keys inserted are 121, 142, 169, 30, 24, 78, 53, and 154. Hash Function is H(K) = K mod 13.Open addressing is the method used for collision resolution in a hash table with linear probing. Which is/are the CORRECT statement about index and their values?

  1. The index of the key 24 is 11
  2. The index of the key 169 is 0
  3. The index of the key 154 is 3
  4. The index of the key 53 is 1

Answer (Detailed Solution Below)

Option :

Hashing Question 7 Detailed Solution

Keys: 121, 142, 169, 30, 24, 78, 53, 154

Hash Function: K mod 13

Hash Table:

Index

Values

0

169

1

78

2

53

3

154

4

121

5

30

6

 

7

 

8

 

9

 

10

 

11

24

12

142

Therefore 1, 2, and 3 options correct statement

The index of the key 53 is 2

Therefore option 4 is incorrect

Hashing Question 8:

In Hash table H, collision is resolved by using chaining. There are 29 slots in H. The average number of elements stored in a chain is 130. What is the total number of elements stored in H?

Answer (Detailed Solution Below) 3770

Hashing Question 8 Detailed Solution

Data: 

Total slots = total chain = 29

Average no. of elements stored in a chain = load factor = 175

Formula:

 \(load\; factor = \frac{Total\;elements}{number \;of \;slots}\)

Calculation:

\(130 = \frac{Total \;elements}{29}\)

Total number of elements = 130 × 29 = 3770.

Hashing Question 9:

In hashing, collision results when _______.

  1. an attempt is made to insert a record at full primary bucket.
  2. an attempt is made to insert a record anywhere in primary bucket.
  3. an attempt is made to insert a record at empty primary bucket.
  4. an attempt is made to delete a record at full primary bucket.

Answer (Detailed Solution Below)

Option 1 : an attempt is made to insert a record at full primary bucket.

Hashing Question 9 Detailed Solution

Collision occurs when two items hash to the same slot. Ideally, a perfect hash function is the one in which no collision occurs. But this is not possible in real world applications. Hence when an attempt is made to insert a record at a slot which is full or at a primary bucket which is full, collision occurs.

Hashing Question 10:

A hash table of length (n) 5 uses hashing to insert a value (k) and linear probing to resolve the collision. After inserting 4, 25, 83, 77, 40 into an empty hash table, the table is as shown below.

Index

Key

0

4

1

25

2

40

3

77

4

83

 

Which one of the following hash function will distribute elements as shown in the above hash table?

  1. K mod (n – 1)
  2. (K – 1) mod n
  3. K mod (n + 1)
  4. (K + 1) mod n

Answer (Detailed Solution Below)

Option 4 : (K + 1) mod n

Hashing Question 10 Detailed Solution

No. of slots (n) = 5

For option 1:

h(4) = k mod (n - 1) = 4 mod 4 = 0

h(25) = k mod (n - 1) = 25 mod 4 = 1

h(40) = k mod (n - 1) = 40 mod 4 = 0 (2 by linear probing)

h(83) = k mod (n - 1) = 83 mod 4 = 3

h(77) = k mod (n - 1) = 77 mod 4 = 1 ( 4 by linear probing)

Two collisions and hence option 4 is more suitable  Hence option 1 is incorrect.

For option 2:

h(4) = (k - 1) mod n = 3 mod 5 = 3

but h(4) = 0. Hence option 2 is incorrect.

For option 3:

h(4) = k mod (n+1) = 4 mod 6 = 4

but h(4) = 0. Hence option 2 is incorrect.

For option 4:

h(4) = (k+1) mod n = 5 mod 5 = 0

h(25) = (k+1) mod n = 26 mod 5 = 1

h(83) = (k+1) mod n = 84 mod 5 = 4

h(77) = (k+1) mod n = 78 mod 5 = 3

h(40) = (k+1) mod n = 41 mod 5 = 1 (2)→ Here, collision occurs.

By linear probing, insert 40 at the next free slot.

h(40) = 2
Get Free Access Now
Hot Links: teen patti master list teen patti gold apk download all teen patti master teen patti king