Question 1

Time: 00:00:00
What is the time complexity of inserting an element into a hash table?

O(log n)

O(log n)

O(n)

O(n)

O(1)

O(1)

O(n^2)

O(n^2)

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 the purpose of a hash function in a hash table?

 

To generate random numbers

To generate random numbers

To convert a key into an index

To convert a key into an index

To sort the elements in the hash table

To sort the elements in the hash table

To delete elements from the hash table

To delete elements from the hash table

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

Please login to submit your explanation

Question 3

Time: 00:00:00
How are collisions handled in a hash table?

By discarding the new key-value pair

By discarding the new key-value pair

By replacing the existing key-value pair with the new one

By replacing the existing key-value pair with the new one

By chaining the new key-value pair to the existing one using a linked list

By chaining the new key-value pair to the existing one using a linked list

By resizing the hash table to accommodate the new key-value pair

By resizing the hash table to accommodate the new key-value pair

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

Please login to submit your explanation

Question 4

Time: 00:00:00
How can you retrieve the value associated with a key in a hash table?

 

By searching the entire hash table sequentially

By searching the entire hash table sequentially

By performing a binary search on the hash table

By performing a binary search on the hash table

By hashing the key and directly accessing the corresponding bucket

By hashing the key and directly accessing the corresponding bucket

By resizing the hash table to accommodate the new key-value pair

By resizing the hash table to accommodate the new key-value pair

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

Please login to submit your explanation

Question 5

Time: 00:00:00
How does a hash table handle collisions?

By discarding the new element

By discarding the new element

By replacing the existing element with the new one

By replacing the existing element with the new one

By storing both elements in the same array index

By storing both elements in the same array index

By rehashing the elements

By rehashing the elements

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

Please login to submit your explanation

Question 6

Time: 00:00:00
Which of the following is NOT a requirement for a good hash function?

Deterministic

Deterministic

Produces the same hash value for equal inputs

Produces the same hash value for equal inputs

Produces unique hash values for all inputs

Produces unique hash values for all inputs

Distributes hash values uniformly across the array

Distributes hash values uniformly across the array

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

Please login to submit your explanation

Question 7

Time: 00:00:00
What is the correct function definition for quadratic probing?

F(i) = 1

F(i) = 1

F(i) = i

F(i) = i

F(i) = i^2

F(i) = i^2

F(i) = i + 1

F(i) = i + 1

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

Please login to submit your explanation

Question 8

Time: 00:00:00
A hash table can store a maximum of 10 records. Currently there are records in locations 1, 3, 4, 7, 8, 9, 10. The probability of a new record going into location 2, with a hash function resolving collisions by linear probing is

0.5

0.5

0.6

0.6

0.7

0.7

0.8

0.8

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

Please login to submit your explanation

Question 9

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,53,33

46,34,42,23,53,33

46,42,34,62,23,33

46,42,34,62,23,33

46,42,44,52,23,33

46,42,44,52,23,33

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

Please login to submit your explanation

Question 10

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

10

10

2

2

5

5

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!","Keep trying!","Not bad!","Good work!","Perfect!"]

Personalized Analytics only Availble for Logged in users

Analytics below shows your performance in various Mocks on PrepInsta

Your average Analytics for this Quiz

Rank

-

Percentile

0%

Get over 200+ Courses under One Subscription

mute

Don’t settle Learn from the Best with PrepInsta Prime Subscription

Learn from Top 1%

One Subscription, For Everything

The new cool way of learning and upskilling -

Limitless Learning

One Subscription access everything

Job Assurance

Get Access to PrepInsta Placement Cell

Top Faculty

from FAANG/IITs/TOP MNC's

Get over 200+ course One Subscription

Courses like AI/ML, Cloud Computing, Ethical Hacking, C, C++, Java, Python, DSA (All Languages), Competitive Coding (All Languages), TCS, Infosys, Wipro, Amazon, DBMS, SQL and others.

Comments