Hashing: GATE CS Previous Year Questions

Hashing · Data Structures

19 questions · asked in 14 of 27 years (2000–2026)

MCQ 13 · MSQ 2 · NAT 41-mark 10 · 2-mark 9

2000Questions per year2026

Questions 6–10 of 19

Q6GATE 2021 (Session 1)2 marksMSQ
Consider a dynamic hashing approach for 4-bit integer keys:

1. There is a main hash table of size 4.
2. The 2 least significant bits of a key is used to index into the main hash table.
3. Initially, the main hash table entries are empty.
4. Thereafter, when more keys are hashed into it, to resolve collisions, the set of all keys corresponding to a main hash table. entry is organized as a binary tree that grows on demand.
5. First, the 3rd least significant bit is used to divide the keys into left and right subtrees.
6. To resolve more collisions, each node of the binary tree is further sub-divided into left and right subtrees based on the 4th least significant bit.
7. A split is done only if it is needed, i.e., only when there is a collision.

Consider the following state of the hash table.
00 01 10 11 empty 0 1 0 1 0 1
Which of the following sequences of key insertions can cause the above state of the hash table (assume the keys are in decimal notation)?

One or more options are correct.

Q7GATE 20201 markNAT
Consider a double hashing scheme in which the primary hash function is h1(k)=k  mod  23h_1(k)=k\; mod \; 23, and the secondary hash function is h2(k)=1+(k  mod  19)h_2(k)=1+(k\; mod \; 19). Assume that the table size is 23. Then the address returned by probe 1 in the probe sequence (assume that the probe sequence begins at probe 0) for key value k=90 is_____________.

Q8GATE 2015 (Session 2)2 marksMCQ−0.67 if wrong
Which one of the following hash functions on integers will distribute keys most uniformly over 10 buckets numbered 0 to 9 for i ranging from 0 to 2020?

Q9GATE 2015 (Session 3)1 markNAT
Given a hash table T with 25 slots that stores 2000 elements, the load factor α\alpha for T is ____________.

Q10GATE 2014 (Session 1)2 marksMCQ−0.67 if wrong
Consider a hash table with 9 slots. The hash function is h(k)=k mod 9. The collisions are resolved by chaining. The following 9 keys are inserted in the order: 5, 28, 19, 15, 20, 33, 12, 17, 10. The maximum, minimum, and average chain lengths in the hash table, respectively, are

Keep practising

Topics in Data Structures

All CS topics ›