Coginzant Hash Table Questions & 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?

Hash Tables Questions AMCAT

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

Start

Question 2

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

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

Start

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

Start

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

Start

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

Start

["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"]