chapter

    Hash Tables and Collision Resolution Practice Questions for Gate Da

    Solve 209+ Hash Tables and Collision Resolution practice questions for GATE DA with answers and detailed solutions. Free sample questions below.

    Try a question

    Answer it here to see how it works. Nothing is recorded until you sign in.

    Question 1
    Level 1: Warm-up

    Match the operations with their corresponding expected number of probes for a hash table with load factor .

    List I (Operation):

    P. Unsuccessful Search

    Q. Insertion

    R. Successful Search

    List II (Formula):

    Question 2
    Level 1: Warm-up

    For a hash table of size using linear probing, what is the formula for the -th probe index for a key , given the base hash function ?

    Question 3
    Level 1: Warm-up

    Consider the following assertion and reason:

    Assertion (A): In the worked example with and , the key 14 is stored at index 4.

    Reason (R): The initial hash of 14 is 2, and slots 2 and 3 are occupied.

    Question 4
    Level 1: Warm-up

    Consider the following assertion and reason:

    Assertion (A): The expected number of probes for inserting a new element into a hash table with load factor is 2.

    Reason (R): Insertion requires finding an empty slot, which is mathematically identical to an unsuccessful search, given by .

    Question 5
    Level 1: Warm-up

    Consider the following assertion and reason:

    Assertion (A): For a hash table with load factor , the expected number of probes for a successful search is 2.

    Reason (R): The successful search formula is , which for gives .

    Question 6
    Level 1: Warm-up

    A hash table of size uses linear probing with the hash function . For the key , what is the index checked on the 3rd probe?

    Question 7
    Level 1: Warm-up

    A hash table of size uses linear probing with the hash function . For the key , what is the index checked on the 5th probe?

    Question 8
    Level 1: Warm-up

    Under the uniform hashing assumption, find the expected number of probes for a successful search in a hash table with load factor . Which of the following expressions correctly represent this value?

    Question 9
    Level 1: Warm-up

    Consider the following assertion and reason.

    Assertion (A): Under uniform hashing, the expected number of probes for an unsuccessful search is , where is the load factor.

    Reason (R): Each additional probe is needed only if every slot examined so far was occupied.

    Choose the correct option.

    Question 10
    Level 1: Warm-up

    Consider the assertion: 'The expected number of probes for an unsuccessful search in a hash table under uniform hashing is bounded by '. If the load factor is , what is the value of this bound?

    Free preview ends here

    Login to view the complete practice questions and solutions

    Creating an account is free. You get the rest of this chapter, step-by-step solutions, and a study plan built around the topics you are actually weak at.

    Explore complete test series, official past papers, and chapter-wise study tools.

    Why MastersUp

    Personalised first. High quality throughout.

    Most platforms hand everyone the same content. Here the content moves with your performance, topic by topic.

    Built around you, not around a syllabus PDF

    Every answer you give moves your topic-level intelligence rate. The next question, the next revision card and tomorrow's plan all change with it.

    Revision that hits your weak spots

    We only revise topics you have actually attempted and are still below the safe bar on — never the same chapter on repeat.

    Questions calibrated to the real exam

    Each question carries a measured toughness. You are served a rung above your current level, so practice keeps stretching you.

    Notes written for recall, not for volume

    Full lesson cards for first study, curated short-note cards for the last mile — with derivations, traps and exam patterns marked.

    One place for everything

    Notes, chapter practice, previous-year questions, test series and full-length papers — all feeding one picture of your preparation.

    Honest progress

    No vanity streaks. Progress here means chapters mastered and accuracy that held up on harder questions.

    Unlock the whole course

    Full notes and short notes, the complete question bank with worked solutions, mock tests, full-length papers, and an adaptive plan that rebuilds itself as you improve.

    Hash Tables and Collision Resolution Practice Questions for GATE DA

    Solve 209+ Hash Tables and Collision Resolution practice questions for GATE DA with answers and detailed solutions. Free sample questions below.

    Chapter Roadmap: Hash Tables and Collision Resolution

    Chapter Roadmap

    Hash Tables and Collision Resolution

    Master the art of mapping keys to indices and resolving the inevitable collisions with mathematical precision.

    Your Learning Journey

    Topic 1
    Open Addressing and Linear Probing
    Keep all elements inside the table. Resolve collisions by probing the next available slot sequentially.
    Topic 2
    Uniform Hashing and Probe Complexity
    Analyze the expected number of probes for successful and unsuccessful searches using probabilistic models.

    Open Addressing and Linear Probing

    Data Structures > Hash Tables

    Open Addressing and Linear Probing

    What happens when two keys hash to the same index? Open addressing finds them a new home within the same table.

    What you will learn here

    01
    Open Addressing
    Keeping all elements strictly inside the hash table array.
    02
    Linear Probing
    Resolving collisions by sequentially checking the next slots.
    03
    Tracing and Traps
    Step-by-step insertion and avoiding primary clustering.

    Hash Tables and Collision Resolution: Solved Questions with Step-by-Step Explanations (10 Problems)

    Question 1 · Programming, Data Structures and Algorithms MCQ

    Match the operations with their corresponding expected number of probes for a hash table with load factor .

    List I (Operation):

    P. Unsuccessful Search

    Q. Insertion

    R. Successful Search

    List II (Formula):

    1. A.

      P-1, Q-1, R-2

    2. B.

      P-1, Q-2, R-1

    3. C.

      P-2, Q-1, R-1

    4. D.

      P-1, Q-2, R-2

    Correct Answer:

    A

    Step-by-Step Solution

    Key idea: This is a match-the-following question testing your ability to map hash table operations to their correct probe complexity formulas.

    Step 1: Unsuccessful Search (P). Probing until an empty slot is found. Formula: . Matches 1.

    Step 2: Insertion (Q). Probing until an empty slot is found to place the new element. This is identical to an unsuccessful search. Formula: . Matches 1.

    Step 3: Successful Search (R). Searching for a key already in the table. Formula: . Matches 2.

    Final mapping: P-1, Q-1, R-2.

    Common trap: A student might misread the condition for insertion and think it requires a successful search formula, matching Q with 2.

    Answer: P-1, Q-1, R-2

    Question 2 · Programming, Data Structures and Algorithms MCQ

    For a hash table of size using linear probing, what is the formula for the -th probe index for a key , given the base hash function ?

    1. A.

    2. B.

    3. C.

    4. D.

    Correct Answer:

    C

    Step-by-Step Solution

    Key idea: This is a direct recall question about the linear probing formula.

    Step 1: Recall that linear probing resolves collisions by checking the next sequential slot.

    Step 2: The formula for the -th probe is the base hash plus the probe number , all modulo the table size .

    Step 3: This matches .

    Answer: C

    Question 3 · Programming, Data Structures and Algorithms MCQ

    Consider the following assertion and reason:

    Assertion (A): In the worked example with and , the key 14 is stored at index 4.

    Reason (R): The initial hash of 14 is 2, and slots 2 and 3 are occupied.

    1. A.

      Both A and R are true, and R is the correct explanation of A.

    2. B.

      Both A and R are true, but R is NOT the correct explanation of A.

    3. C.

      A is true but R is false.

    4. D.

      A is false but R is true.

    Correct Answer:

    A

    Step-by-Step Solution

    Key idea: This is an assertion-reason question testing the worked example of linear probing.

    Step 1: Verify Assertion (A). For key 14, . Slot 2 is occupied by key 4. Probe slot 3, occupied by key 1. Probe slot 4, which is empty. So key 14 is stored at index 4. Assertion (A) is true.

    Step 2: Verify Reason (R). The initial hash of 14 is indeed 2. Slots 2 and 3 are occupied (by keys 4 and 1, respectively). Reason (R) is true.

    Step 3: Check if (R) explains (A). Yes, (R) correctly explains why key 14 ends up at index 4: it hashes to 2, finds slots 2 and 3 occupied, and probes to slot 4.

    Both (A) and (R) are true, and (R) is the correct explanation of (A).

    Common trap: A student might compute the hash as 42 (forgetting modulo) and think (R) is false. This is a unit mismatch error (not applying modulo).

    Answer: A

    Question 4 · Programming, Data Structures and Algorithms MCQ

    Consider the following assertion and reason:

    Assertion (A): The expected number of probes for inserting a new element into a hash table with load factor is 2.

    Reason (R): Insertion requires finding an empty slot, which is mathematically identical to an unsuccessful search, given by .

    1. A.

      Both A and R are true and R is the correct explanation of A.

    2. B.

      Both A and R are true but R is NOT the correct explanation of A.

    3. C.

      A is true but R is false.

    4. D.

      A is false but R is true.

    Correct Answer:

    A

    Step-by-Step Solution

    Key idea: This is an assertion-reason question testing the conceptual link between insertion and unsuccessful search complexities.

    Step 1: Verify Assertion (A). The expected probes for insertion with is calculated using the unsuccessful search formula: . Assertion (A) is true.

    Step 2: Verify Reason (R). Insertion requires probing until an empty slot is found. This is the exact definition of an unsuccessful search (probing until an empty slot is found to conclude the key is absent). Thus, the formulas are identical. Reason (R) is true.

    Step 3: Check if (R) explains (A). Yes, (R) correctly identifies that insertion is identical to an unsuccessful search, which is the exact reason why the formula yields 2 for .

    Both (A) and (R) are true, and (R) is the correct explanation of (A).

    Common trap: A student might confuse insertion with a successful search, thinking (R) is false because "insertion is a successful operation". This is a unit mismatch of operation types.

    Answer: A

    Question 5 · Programming, Data Structures and Algorithms MCQ

    Consider the following assertion and reason:

    Assertion (A): For a hash table with load factor , the expected number of probes for a successful search is 2.

    Reason (R): The successful search formula is , which for gives .

    1. A.

      Both A and R are true and R is the correct explanation of A.

    2. B.

      Both A and R are true but R is NOT the correct explanation of A.

    3. C.

      A is true but R is false.

    4. D.

      A is false but R is true.

    Correct Answer:

    D

    Step-by-Step Solution

    Key idea: This is an assertion-reason question testing the successful search formula and calculation.

    Step 1: Evaluate Assertion (A). For , the expected probes for successful search is:

    The assertion claims , which is incorrect. A is FALSE.

    Step 2: Evaluate Reason (R). The formula is correct, and the calculation is also correct. R is TRUE.

    Step 3: Since A is false and R is true, the answer is D.

    Common trap: A unit mismatch error occurs if you confuse successful search with unsuccessful search. For , unsuccessful search gives , which matches the assertion. But the question is about successful search.

    Question 6 · Programming, Data Structures and Algorithms NAT

    A hash table of size uses linear probing with the hash function . For the key , what is the index checked on the 3rd probe?

    Correct Answer:

    3.00

    Step-by-Step Solution

    Key idea: This is a direct formula application question using the linear probing probe sequence .

    Step 1: Compute the initial hash for .

    .

    Step 2: Identify the probe index for the 3rd probe.

    The 1st probe is .

    The 2nd probe is .

    The 3rd probe is .

    Step 3: Compute the index for the 3rd probe.

    .

    Answer: 3.00

    Question 7 · Programming, Data Structures and Algorithms NAT

    A hash table of size uses linear probing with the hash function . For the key , what is the index checked on the 5th probe?

    Correct Answer:

    1.00

    Step-by-Step Solution

    Key idea: This is a direct formula application question using the linear probing probe sequence .

    Step 1: Compute the initial hash for .

    .

    Step 2: Identify the probe index for the 5th probe.

    The 1st probe is .

    The 2nd probe is .

    The 3rd probe is .

    The 4th probe is .

    The 5th probe is .

    Step 3: Compute the index for the 5th probe.

    .

    Answer: 1.00

    Question 8 · Programming, Data Structures and Algorithms MSQ

    Under the uniform hashing assumption, find the expected number of probes for a successful search in a hash table with load factor . Which of the following expressions correctly represent this value?

    1. A.

    2. B.

    3. C.

      $2$

    4. D.

    Correct Answer:

    ["A","B"]

    Step-by-Step Solution

    Key idea: This is a direct formula application question testing the expected probe complexity for a successful search under uniform hashing.

    Step 1: Recall the formula for the expected number of probes for a successful search:

    Step 2: Substitute the given load factor :

    Step 3: Simplify the expression:

    Step 4: Check equivalent forms using logarithm properties:

    Since , we have .

    Step 5: Evaluate the options:

    • Option A: (Correct)
    • Option B: (Correct)
    • Option C: $2$ (Incorrect, this is the expected probes for an unsuccessful search: )
    • Option D: (Incorrect, misreads the factor as )

    Answer: A, B

    Question 9 · Programming, Data Structures and Algorithms MCQ

    Consider the following assertion and reason.

    Assertion (A): Under uniform hashing, the expected number of probes for an unsuccessful search is , where is the load factor.

    Reason (R): Each additional probe is needed only if every slot examined so far was occupied.

    Choose the correct option.

    1. A.

      A is false, but R is true

    2. B.

      Both A and R are true, and R is the correct explanation of A

    3. C.

      A is true, but R is false

    4. D.

      Both A and R are true, but R is not the correct explanation of A

    Correct Answer:

    A

    Step-by-Step Solution

    Key idea: judge each sentence on its own. The assertion quotes a formula to recall; the reason states the counting logic behind the formula.

    Step 1: The correct expected-probe formula for an unsuccessful search under uniform hashing is , not .

    Step 2: So Assertion (A) is false — the sign in the denominator is wrong.

    Step 3: Reason (R) says an extra probe is needed only when all slots examined so far were occupied. That is exactly the correct logic: the second probe needs the first occupied, the third needs the first two occupied, and so on, producing the series .

    Step 4: Hence R is true while A is false.

    Answer: A is false, but R is true.

    Trap: misremembering the formula as makes the assertion look true and leads to the "both true" options.

    Check: summing confirms the correct denominator is .

    Question 10 · Programming, Data Structures and Algorithms NAT

    Consider the assertion: 'The expected number of probes for an unsuccessful search in a hash table under uniform hashing is bounded by '. If the load factor is , what is the value of this bound?

    Correct Answer:

    4.00

    Step-by-Step Solution

    Key idea: This is a bounding and formula evaluation question testing the unsuccessful search probe complexity formula.

    Step 1: Identify the formula for the expected probes in an unsuccessful search.

    Step 2: Substitute the given load factor .

    Step 3: Compute the value.

    Answer: 4.00

    More practice questions in this unit