Hiremee Quiz on Hash Tables with Answers

Question 1

Time: 00:00:00
A hash table of length 10 uses open addressing with hash function h(k)=k mod 10, and linear probing. After inserting 6 values into an empty hash table, the table is as shown below. Which one of the following choices gives a possible order in which the key values could have been inserted in the table?

 

46, 42, 34, 52, 23, 33

46, 42, 34, 52, 23, 33

46, 34, 42, 23, 52, 33

46, 34, 42, 23, 52, 33

34, 42, 23, 52, 33, 46

34, 42, 23, 52, 33, 46

42, 46, 33, 23, 34, 52

42, 46, 33, 23, 34, 52

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Question 2

Time: 00:00:00
What is a hash function?

A function has allocated memory to keys

A function has allocated memory to keys

A function that computes the location of the key in the array

A function that computes the location of the key in the array

A function that creates an array

A function that creates an array

None of the mentioned

None of the mentioned

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Question 3

Time: 00:00:00
What is the search complexity in direct addressing?

O(n)

O(n)

O(logn)

O(logn)

O(nlogn)

O(nlogn)

O(1)

O(1)

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Question 4

Time: 00:00:00
What is the best that can be the techniques to avoid collision?

Make the hash function appear random

Make the hash function appear random

Use the chaining method

Use the chaining method

Use uniform hashing

Use uniform hashing

All of the mentioned

All of the mentioned

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Question 5

Time: 00:00:00
Consider a hash function that distributes keys uniformly. The hash table size is 20. After hashing of how many keys will the probability that any new key hashed collides with an existing one exceed 0.5?

40

40

2

2

5

5

10

10

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Question 6

Time: 00:00:00
While finding the correct location for saving key value pair, how many times the key is hashed?

1

1

2

2

3

3

unlimited till bucket is found

unlimited till bucket is found

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Question 7

Time: 00:00:00
Is hashmap an ordered collection, in java?

True

True

False

False

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Question 8

Time: 00:00:00
Map implements collection interface?

True

True

False

False

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Question 9

Time: 00:00:00
Which of the below does not implement Map interface?

HashMap

HashMap

HashTable

HashTable

EnumMap

EnumMap

Vector

Vector

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Question 10

Time: 00:00:00
What is the premise of equality for IdentityHashMap?

Reference equality

Reference equality

Name equality

Name equality

Hashcode equality

Hashcode equality

Length equality

Length equality

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

["0","40","60","80","100"]
["Need more practice! \r\n \r\n","Keep trying! \r\n \r\n","Not bad! \r\n \r\n","Good work! \r\n \r\n","Perfect! \r\n \r\n"]