• Courses
  • Tutorials
  • Jobs
  • Practice
  • Contests

Top MCQs on Hash Data Strcuture with Answers

Question 11

Consider a hash table of size m = 10000, and the hash function h(K) = floor (m(KA mod 1)) for A = ( √(5) – 1)/2. The key 123456 is mapped to location ______.
  • 46
  • 41
  • 43
  • 48

Question 12

Consider a 13 element hash table for which f(key)=key mod 13 is used with integer keys. Assuming linear probing is used for collision resolution, at which location would the key 103 be inserted, if the keys 661, 182, 24 and 103 are inserted in that order?

  • 0

  • 1

  • 11

  • 12

Question 13

What will be the cipher text produced by the following cipher function for the plain text ISRO with key k =7. [Consider \'A\' = 0, \'B\' = 1, .......\'Z\' = 25]. Ck(M) = (kM + 13) mod 26
  • RJCH
  • QIBG
  • GQPM
  • XPIN

Question 14

Consider a hash table of size m = 100 and the hash function h(k) = floor(m(kA mod 1)) for Compute the location to which the key k = 123456 is placed in hash table.

  • 77

  • 82

  • 88

  • 89

Question 15

A hash table with 10 buckets with one slot per bucket is depicted here. The symbols, S1 to S7 are initially entered using a hashing function with linear probing. The maximum number of comparisons needed in searching an item that is not present is

  • 4

  • 5

  • 6

  • 3

Question 16

A hash function h defined h(key)=key mod 7, with linear probing, is used to insert the keys 44, 45, 79, 55, 91, 18, 63 into a table indexed from 0 to 6. What will be the location of key 18 ?
  • 3
  • 4
  • 5
  • 6

Question 17

Consider a double hashing scheme in which the primary hash function is h1(k) = k mod 23, and the secondary hash function is h2(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 ________ . 

  • 13

  • 15

  • 21

  • 23

Question 18

Consider a dynamic hashing approach for 4-bit integer keys:
  • (A) There is a main hash table of size 4.
  • (B) The 2 least significant bits of a key is used to index into the main hash table.
  • (C) Initially, the main hash table entries are empty.
  • (D) 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.
  • (E) First, the 3rd least significant bit is used to divide the keys into left and right subtrees.
  • (F) 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.
  • (G) 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. Which of the following sequences of key insertions can cause the above state of the hash table (assume the keys are in decimal notation)?
  • 5,9,4,13,10,7
  • 9,5,10,6,7,1
  • 10,9,6,7,5,13
  • 9,5,13,6,10,14

Question 19

Consider double hashing of the form h(k,i)=(h​ 1​ (k)+ih​ 2​ (k)) mod m Where h​ 1​ (k)=k mod m h​ 2​ (k)=1+(k mod n) Where n=m-1and m=701 for k=123456, what is the difference between first and second probes in terms of slots?
  • 255
  • 256
  • 257
  • 258

Question 20

An advantage of chained hash table (external hashing) over the open addressing scheme is

  • Worst case complexity of search operations is less

  • Space used is less

  • Deletion is easier

  • None of the above

There are 30 questions to complete.

Last Updated :
Take a part in the ongoing discussion