wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

DSA - Practice Quiz - 1

Total questions: 15

Worksheet time: 8mins

Name
Class
Date
1.

The number of swaps made by selection sort algorithm in each iteration is _________

a)

1

b)

N

c)

N-1

d)

depends on the input

2.

The worst case complexity of linear search is _______

a)

O(1)

b)

O(logn)

c)

O(n2)

d)

O(n)

3.

What is the best case time complexity of merge sort?

a)

O(n^2)

b)

O(n)

c)

O(nlogn)

d)

O(logn)

4.

If the list has n numbers and the largest number has m digits, then the radix sort algorithm requires ____ passes to give the output.

a)

mn

b)

m/n

c)

n

d)

m

5.

If the bubble sort algorithm gets a list in descending order as input, it will perform ________ number swaps.

a)

maximum

b)

minimum

c)

1

d)

0

6.

The selection sort algorithm finds the largest element in the list and swap it with the last element. State true or false.

a)

True

b)

False

7.

Which of the following algorithms work similar to the way in which the playing cards are sorted?

a)

insertion sort

b)

bubble sort

c)

radix sort

d)

quick sort

8.

Identify the algorithm that uses divide and conquer method

a)

Binary search

b)

quick sort

c)

merge sort

d)

all the mentioned

9.

The quick sort algorithm splits the list into equal halves in each and every partitioning. State true or false.

a)

True

b)

False

10.

In the brute-force string matching algorithm, the number of characters by which the pattern will be shifted towards right on a mismatch is ______

a)

1

b)

n

c)

0

d)

None of the mentioned

11.

Quadratic probing is an example of

a)

Closed hashing

b)

open hashing

12.

Which of the following can not be the load factor in closed hashing?

a)

0

b)

-1

c)

1

d)

0.5

13.

Identify the index at which the data element 15 will be stored in a hash table of size 7 when linear probing is used for collision resolution and if 8 and 22 are already inserted.

a)

1

b)

0

c)

3

d)

2

14.

If the pattern is not found in the text, the string matching algorithm will return ____

a)

-1

b)

0

c)

1

d)

n

15.

The merge sort algorithm divides the list into sub lists until we get a list with ____ number of elements.

a)

2

b)

1

c)

even

d)

equal