wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

DS QUIZ

Total questions: 10

Worksheet time: 5mins

Name
Class
Date
1.

Given two sorted list of size m and n respectively. The number of comparisons needed the worst case by the merge sort algorithm will be

a)

m x n

b)

maximum of m and n

c)

minimum of m and n

d)

m + n - 1

2.

If one uses a straight two-way merge sort algorithm to sort the following elements in ascending order: 20, 47, 15, 8, 9, 4, 40, 30, 12, 17 then the order of these elements after the second pass of the algorithm is:

a)

8, 9, 15, 20, 47, 4, 12, 17, 30, 40

b)

8, 15, 20, 47, 4, 9, 30, 40, 12, 17

c)

15, 20, 47, 4, 8, 9, 12, 30, 40, 17

d)

4, 8, 9, 15, 20, 47, 12, 17, 30, 40

3.

What is the best sorting algorithm to use for the elements in an array that are more than 1 million in general?

a)

Selection sort.

b)

Quick sort

c)

Bubble sort.

d)

Insertion sort.

4.

How many subarrays does the quick sort algorithm divide the entire array into?

a)

1

b)

2

c)

3

d)

4

5.

What is direct addressing?

a)

Distinct array position for every possible key

b)

Fewer array positions than keys

c)

Fewer keys than array positions

d)

Same array position for all keys

6.

What is a hash table?

a)

A structure used to implement stack and queue

b)

 A structure that maps values to keys

c)

A structure that maps keys to values

d)

A structure used for storage

7.

A Hash Function f is defined as f(key) = key mod 7. With linear probing, while inserting the keys 37, 38, 72, 48, 98, 11, and 56 into a table indexed from 0, in which location the key 11 will be stored (count table index 0 as 0th location)?

a)

4

b)

3

c)

5

d)

6

8.

The minimum number of edges in a connected graph with N vertices is:

a)

A) N

b)

B) N – 1

c)

C) N + 1

d)

D) 2N

9.

Binary search can only be applied on:



a)

A) Linked list

b)

B) Sorted array

c)

C) Unsorted array

d)

D) Hash table

10.

In binary search, if the key is less than the middle element, the search continues:


a)

A) In the right half

b)

B) In the left half

c)

C) In entire array again

d)

D) Search stops