Robert Bosch Hash Tables Quiz 3

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

Start

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

Start

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

Start

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

Start

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

Start

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

Start

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

Start

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

Start

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

Start

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

Start

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

Completed

0/10

Accuracy

0%

Get Prepinsta Prime

Get all 200+ courses offered by Prepinsta

Never Miss an OffCampus Update

Get OffCampus Updates on Social Media from PrepInsta

Follow us on our Media Handles, we post out OffCampus drives on our Instagram, Telegram, Discord, Whatsdapp etc.

Get Hiring Updates
Amazon,Google,Delottie & 30+companies are hiring ! Get hiring Updates right in your inbox from PrepInsta

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.

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.

Get PrepInsta Prime Subscription

Get access to all the courses that PrepInsta offers, check the out below -

Companies

TCS, Cognizant, Delloite, Infosys, Wipro, CoCubes, KPMG, Amazone, ZS Associates, Accenture, Congnizant & other 50+ companies

Programming

Data Structures, Top 500 Codes, C, C++, Java Python & other 10+ subjects

Skills

Full Stack Web Development, Data Science, Machine Learning, AWS Cloud, & other 10+ skills and 20+ projects

Comments