wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

C++ Searches and Sorts

Total questions: 9

Worksheet time: 27mins

Name
Class
Date
1.

Linear search algorithm:

a)

Scans each index until finding a matching value

b)

Repeatedly dividing in half the array until found

c)

Bubble sorting technique

d)

None of them

2.

Linear Search works when the array is?

a)

Sorted

b)

Unsorted

c)

Both

d)

None of the above

3.

A binary search algorithm can be best described as what?

a)

A instant lookup method

b)

Repeatedly dividing in half the array until found

c)

Start at the head, move through the list until found

d)

None of the above

4.

When is Binary Search preferred over Linear Search?

a)

Small Database

b)

Sorted Database

c)

Unsorted Database

d)

None of the above

5.

Using binary search in this sorted array:

3 7 10 45 84 100 153 170

How many comparisons would it take to find number 170?

a)

0 – 1

b)

1 – 2

c)

3 – 4

d)

4 – 5

6.

The maximum comparisons needed in Binary Search on array of size 16 is:

a)

16

b)

8

c)

4

d)

5

7.

The maximum comparisons needed in Linear Search on array of size 32 is:

a)

32

b)

33

c)

16

d)

31

8.

Insertion sort is a sorting algorithm in which the elements are transferred one at a time to the right position

a)

True

b)

False

9.

What is the first change that insertion sort would make to this sequence?

“6 2 5 9”

a)

6 9 5 2

b)

5 9 6 2

c)

9 5 2 6

d)

2 6 5 9