wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Hash Table and Sorting Algorithms Quiz

Total questions: 10

Worksheet time: 5mins

Name
Class
Date
1.

What is the time complexity for searching, inserting, and deleting elements in a hashtable (in the average case)?

a)

O(1)

b)

O(log n)

c)

O(n)

d)

O(n log n)

2.

What is the function that determines the index of a key in a hashtable?

a)

Sorting function

b)

Mapping function

c)

Hash function

d)

Compression function

3.

In open addressing, which collision resolution technique involves searching for the next available slot in a linear fashion?

a)

Quadratic probing

b)

Double hashing

c)

Linear probing

d)

Random probing

4.

Which of the following is NOT a desirable property of a good hash function?

a)

It should be deterministic.

b)

It should minimize collisions.

c)

It should map similar keys to the same hash value.

d)

It should distribute keys uniformly across the table.

5.

What is the primary purpose of a hashtable?

a)

Sorting data

b)

Storing data for quick retrieval

c)

Compressing data

d)

Securing data

6.

What is the time complexity of mergesort in the worst case?

a)

O(n²)

b)

O(n log n)

c)

O(log n)

d)

O(n)

7.

Mergesort is an example of which algorithmic paradigm?

a)

Dynamic programming

b)

Divide and conquer

c)

Greedy algorithm

d)

Backtracking

8.

During the merging process in mergesort, what is the key operation performed?

a)

Partitioning the array into subarrays

b)

Comparing and combining two sorted subarrays

c)

Searching for a pivot element

d)

Dividing the array into smaller elements

9.

Which of the following is a disadvantage of quicksort?

a)

It requires additional space for merging.

b)

Its performance is highly dependent on pivot selection.

c)

It is not efficient for arrays.

d)

It has a poor average-case time complexity.

10.

When does quicksort perform worst?

a)

When the pivot is always the median of the array.

b)

When the pivot is always the largest or smallest element.

c)

When the input array is already sorted.

d)

When the array has duplicate elements.