500+ Hash Tables (Data Structure) MCQs with FREE PDF

This Hash Tables MCQs and answer with FREE PDF contains multiple choice questions and answers on hash tables, direct addressing tables, hash tables chaining using linked lists, doubly linked lists, binary trees and list heads, hash tables with linear and quadratic probing, hashing functions, hash tree, min hash and double hashing. We have the best collection of Hash Tables MCQs and answer with FREE PDF. These Hash Tables MCQs will help you to prepare for any competitive exams like: BCA, MCA, GATE, GRE, IES, PSC, UGC NET, DOEACC Exams at all levels – you just have to practice regularly.

Hash Tables (Data Structure) MCQs

1. In a hash table of size 10, where is element 7 placed?

a) 6

b) 7

c) 17

d) 16

Answer: 7

2. What should be the load factor for separate chaining hashing?

a) 0.5

b) 1

c) 1.5

d) 2

Answer: 1

3. Which of the following operations are done in a hash table?

a) Insert only

b) Search only

c) Insert and search

d) Replace

Answer: Insert and search

4. Which of the following is identical to that of a separate chaining hash node?

a) Linked list

b) Array

c) Stack

d) Queue

Answer: Linked list

5. Which of the following is the hashing function for separate chaining?

a) H(x)=(hash(x)+f(i)) mod table size

b) H(x)=hash(x)+i2 mod table size

c) H(x)=x mod table size

d) H(x)=x mod (table size * 2)

Answer: H(x)=x mod table size

6. What is the correct notation for a load factor?

a) ?

b) ?

c) ?

d) ?

Answer: ?

7. In hash tables, how many traversal of links does a successful search require?

a) 1+?

b) 1+?2

c) 1+ (?/2)

d) ?3

Answer: 1+ (?/2)

8. Which of the following is a disadvantage of using separate chaining using linked lists?

a) It requires many pointers

b) It requires linked lists

c) It uses array

d) It does not resolve collision

Answer: It requires many pointers

9. What is the worst case search time of a hashing using separate chaining algorithm?

a) O(N log N)

b) O(N)

c) O(N2)

d) O(N3)

Answer: O(N)

50+ Hash Tables Chaining using Linked Lists MCQs PDF Download

10. What is the time complexity of search function in a hash table using a doubly linked list?

a) O(1)

b) O(n)

c) O(log n)

d) O(n log n)

Answer: O(1)

11. What is the time complexity of delete function in the hash table using a doubly linked list?

a) O(1)

b) O(n)

c) O(log n)

d) O(n log n)

Answer: O(1)

12. Hashing can be used to encrypt and decrypt digital signatures.

a) true

b) false

Answer: true

13. What is the advantage of using a doubly linked list for chaining over singly linked list?

a) it takes less memory

b) it is easy to implement

c) it makes the process of insertion and deletion faster

d) it causes less collisions

Answer: it makes the process of insertion and deletion faster

14. Which of the following technique stores data in the hash table itself in case of a collision?

a) Open addressing

b) Chaining using linked list

c) Chaining using doubly linked list

d) Chaining using binary tree

Answer: Open addressing

15. Which of the following technique stores data in a separate entity in case of a collision?

a) Open addressing

b) Chaining using doubly linked list

c) Linear probing

d) Double hashing

Answer: Chaining using doubly linked list

50+ Hash Tables Chaining using Doubly Linked Lists MCQs PDF Download

16. What is the time complexity of the search function in a hash table using a binary tree?

a) O(1)

b) O(n)

c) O(log n)

d) O(n log n)

Answer: O(1)

17. What is the time complexity of the delete function in the hash table using a binary tree?

a) O(1)

b) O(n)

c) O(log n)

d) O(n log n)

Answer: O(1)

18. What is the advantage of a hash table over BST?

a) hash table has a better average time complexity for performing insert, delete and search operations

b) hash table requires less space

c) range query is easy with hash table

d) easier to implement

Answer: hash table has a better average time complexity for performing insert, delete and search operations

19. What is the disadvantage of BST over the hash table?

a) BST is easier to implement

b) BST can get the keys sorted by just performing inorder traversal

c) BST can perform range query easily

d) Time complexity of hash table in inserting, searching and deleting is less than that of BST

Answer: Time complexity of hash table in inserting, searching and deleting is less than that of BST

20. Which of the following technique stores data separately in case of a collision?

a) Open addressing

b) Double hashing

c) Quadratic probing

d) Chaining using a binary tree

Answer: Chaining using a binary tree

21. Separate chaining is easier to implement as compared to open addressing.

a) true

b) false

Answer: true

22. Which of the following variant of a hash table has the best cache performance?

a) hash table using a linked list for separate chaining

b) hash table using binary search tree for separate chaining

c) hash table using open addressing

d) hash table using a doubly linked list for separate chaining

Answer: hash table using open addressing

50+ Hash Tables Chaining with Binary Trees MCQs PDF Download

23. In linear probing, the cost of an unsuccessful search can be used to compute the average cost of a successful search.

a) True

b) False

Answer: True

24. Which of the following is the correct function definition for linear probing?

a) F(i)= 1

b) F(i)=i

c) F(i)=i2

d) F(i)=i+1

Answer: F(i)=i

25. ___________ is not a theoretical problem but actually occurs in real implementations of probing.

a) Hashing

b) Clustering

c) Rehashing

d) Collision

Answer: Clustering

26. What is the hash function used in linear probing?

a) H(x)= key mod table size

b) H(x)= (key+ F(i2)) mod table size

c) H(x)= (key+ F(i)) mod table size

d) H(x)= X mod 17

Answer: H(x)= (key+ F(i)) mod table size

27. Hashing can be used in online spelling checkers.

a) True

b) False

Answer: True

28. Which of the following problems occur due to linear probing?

a) Primary collision

b) Secondary collision

c) Separate chaining

d) Extendible hashing

Answer: Primary collision

50+ Hash Tables with Linear Probing MCQs PDF Download

29. What is the time complexity of search function in a hash table using list head?

a) O(1)

b) O(n)

c) O(log n)

d) O(n log n)

Answer: O(1)

30. What is the time complexity of delete function in the hash table using list head?

a) O(1)

b) O(n)

c) O(log n)

d) O(n log n)

Answer: O(1)

31. Which of the following trait of a hash function is most desirable?

a) it should cause less collisions

b) it should cause more collisions

c) it should occupy less space

d) it should be easy to implement

Answer: it should cause less collisions

32. What is the advantage of using linked list over the doubly linked list for chaining?

a) it takes less memory

b) it causes more collisions

c) it makes the process of insertion and deletion faster

d) it causes less collisions

Answer: it takes less memory

33. What is the worst case time complexity of insert function in the hash table when the list head is used for chaining?

a) O(1)

b) O(n log n)

c) O(log n)

d) O(n)

Answer: O(n)

34. Which of the following technique is used for handling collisions in a hash table?

a) Open addressing

b) Hashing

c) Searching

d) Hash function

Answer: Open addressing

50+ Hash Tables Chaining with List Heads MCQs PDF Download

35. How many constraints are to be met to successfully implement quadratic probing?

a) 1

b) 2

c) 3

d) 4

Answer: 2

36. Which among the following is the best technique to handle collision?

a) Quadratic probing

b) Linear probing

c) Double hashing

d) Separate chaining

Answer: Quadratic probing

37. Which of the following techniques offer better cache performance?

a) Quadratic probing

b) Linear probing

c) Double hashing

d) Rehashing

Answer: Linear probing

38. What is the formula used in quadratic probing?

a) Hash key = key mod table size

b) Hash key=(hash(x)+F(i)) mod table size

c) Hash key=(hash(x)+F(i2)) mod table size

d) H(x) = x mod 17

Answer: Hash key=(hash(x)+F(i2)) mod table size

39. Which of the following schemes does quadratic probing come under?

a) rehashing

b) extended hashing

c) separate chaining

d) open addressing

Answer: open addressing

40. Quadratic probing overcomes primary collision.

a) True

b) False

Answer: True

50+ Hash Tables with Quadratic Probing MCQs PDF Download

41. What can be the value of m in the division method?

a) Any prime number

b) Any even number

c) 2p – 1

d) 2p

Answer: Any prime number

42. Which scheme provides good performance?

a) open addressing

b) universal hashing

c) hashing by division

d) hashing by multiplication

Answer: universal hashing

43. Using division method, in a given hash table of size 157, the key of value 172 be placed at position

a) 19

b) 72

c) 15

d) 17

Answer: 15

44. How many steps are involved in creating a hash function using a multiplication method?

a) 1

b) 4

c) 3

d) 2

Answer: 2

45. What is the hash function used in multiplication method?

a) h(k) = floor( m(kA mod 1))

b) h(k) = ceil( m(kA mod 1))

c) h(k) = floor(kA mod m)

d) h(k) = ceil( kA mod m)

Answer: h(k) = floor( m(kA mod 1))

46. What is the advantage of the multiplication method?

a) only 2 steps are involved

b) using constant

c) value of m not critical

d) simple multiplication

Answer: value of m not critical

47. What is the table size when the value of p is 7 in multiplication method of creating hash functions?

a) 14

b) 128

c) 49

d) 127

Answer: 128

48. What is the value of h(k) for the key 123456?

Given: p=14, s=2654435769, w=32

a) 123

b) 456

c) 70

d) 67

Answer: 67

50+ Hashing Functions MCQs PDF Download

49. Which technique has the greatest number of probe sequences?

a) Linear probing

b) Quadratic probing

c) Double hashing

d) Closed hashing

Answer: Closed hashing

50. What is the value of m’ if the value of m is 19?

a) 11

b) 18

c) 17

d) 15

Answer: 17

51. The value of h2(k) can be composite relatively to the hash table size m.

a) True

b) False

Answer: False

52. Double hashing is one of the best methods available for open addressing.

a) True

b) False

Answer: True

53. What is the hash function used in Double Hashing?

a) (h1(k) – i*h2(k))mod m

b) h1(k) + h2(k)

c) (h1(k) + i*h2(k))mod m

d) (h1(k) + h2(k))mod m

Answer: (h1(k) + i*h2(k))mod m

54. On what value does the probe sequence depend on?

a) c1

b) k

c) c2

d) m

Answer: k

50+ Double Hashing MCQs PDF Download

55. Hash tree is also known as _____

a) Merkle tree

b) T -tree

c) Hash table

d) Bx-tree

Answer: Merkle tree

56. What will be the height of the hash tree with branching factor 2 and with 8 records?

a) 3

b) 5

c) 4

d) 6

Answer: 4

57. Where is the hash tree used?

a) in digital currency

b) in sorting of large data

c) for indexing in databases

d) in encryption of data

Answer: in digital currency

58. What is the worst case time complexity of the insertion in the hash tree?

a) O(logk(n))

b) O(n2)

c) O(nlogk(n))

d) O(kn)

Answer: O(logk(n))

59. Sequential access in a Hash tree is faster than in B-trees.

a) True

b) False

Answer: True

60. Hash tree is used in data synchronisation. In the worst case the data synchronisation takes ______ time.

a) O(logn)

b) O(n2)

c) O(nlogn)

d) O(n)

Answer: O(n)

61. Hash tree is generalization of ______

a) Heap

b) Hash list

c) BST

d) B – tree

Answer: Hash list

62. Hash tree is used in effective data verification in distributed systems.

a) True

b) False

Answer: True

50+ Hash Tree MCQs PDF Download

63. Which indicator is used for similarity between two sets?

a) Rope Tree

b) Jaccard Coefficient

c) Tango Tree

d) MinHash Coefficient

Answer: Jaccard Coefficient

64. Which of the following is defined as the ratio of total elements of intersection and union of two sets?

a) Rope Tree

b) Jaccard Coefficient Index

c) Tango Tree

d) MinHash Coefficient

Answer: Jaccard Coefficient Index

65. What is the value of the Jaccard index when the two sets are disjoint?

a) 1

b) 2

c) 3

d) 0

Answer: 0

66. When are the members of two sets more common relatively?

a) Jaccard Index is Closer to 1

b) Jaccard Index is Closer to 0

c) Jaccard Index is Closer to -1

d) Jaccard Index is Farther to 1

Answer: Jaccard Index is Closer to 1

67. What is the expected error for estimating the Jaccard index using MinHash scheme for k different hash functions?

a) O (log k!)

b) O (k!)

c) O (k2)

d) O (1/k½)

Answer: O (1/k½)

68. How many hashes will be needed for calculating Jaccard index with an expected error less than or equal to 0.05?

a) 100

b) 200

c) 300

d) 400

Answer: 400

69. What is the expected error by the estimator Chernoff bound on the samples performed without replacement?

a) O (log k!)

b) O (k!)

c) O (k2)

d) O (1/k½)

Answer: O (1/k½)

50+ Min Hash MCQs PDF Download

70. 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) It reduces code complexity

Answer: It saves space

71. What is the time complexity to delete an element from the direct address table?

a) O(n)

b) O(logn)

c) O(nlogn)

d) O(1)

Answer: O(1)

72. How is a bit vector better compared to a normal array for implementing the hash table?

a) It saves time

b) It saves space

c) It saves both time and space

d) It reduces code complexity

Answer: It saves space

73. What is direct addressing?

a) Distinct array position for every possible key

b) Fewer array positions than keys

c) Fewer keys than array positions

d) Distinct array positions for keys based on priority

Answer: Distinct array position for every possible key

74. When is it appropriate to use direct addressing?

a) When the array is comparatively large

b) When the universe U of keys is reasonably small

c) When the universe U of keys is reasonably large

d) When the array is comparatively small

Answer: When the universe U of keys is reasonably small

75. What is the search complexity in direct addressing?

a) O(n)

b) O(logn)

c) O(nlogn)

d) O(1)

Answer: O(1)

50+ Direct Addressing Tables MCQs PDF Download

Hash Tables MCQs PDF Download

1000+ Data Structure MCQs

Abstract Data Types
Application of Stacks
Arrays Types
Types of Lists
Binary Trees
B Trees
Trees
Heap
Trie
Hash Tables
Graph