wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Algorithms: Revision Questions

Total questions: 20

Worksheet time: 13mins

Name
Class
Date
1.
Select the best description to explain what a linear search algorithm is.
a)
Put the elements in order, check each item in turn.
b)
Put the elements in order, compare with the middle value, split the list in order and repeat.
c)
Elements do not need to be in order, check each item in turn.
d)
Elements do not need to be in order, compare to the middle value, split the list in order and repeat
2.

Select the best description to explain what a binary search algorithm is.

a)

Put the elements in order, check each item in turn.

b)

Put the elements in order, compare with the middle value, split the list in order and repeat.

c)

Elements do not need to be in order, check each item in turn.

d)

Elements do not need to be in order, compare to the middle value, split the list in order and repeat

3.
A linear search is to be performed on the list:
12   6   8  1  3
How many comparisons would it take to find number 1?
a)
1
b)
2
c)
3
d)
4
4.
A binary search is to be performed on the list:
3  5  9  10  23
How many comparisons would it take to find number 9?
a)
0-1
b)
2-3
c)
4-5
d)
I can't find the number 9
5.

Which of these algorithms eliminates half of its possibilities each time it makes a check?

a)

Binary search

b)

Bubble sort

c)

Merge sort

d)

Linear search

6.

If the value is not present then sequential/linear search will return

a)

true

b)

false

c)

-1

d)

the value

7.

Which of the following facts about arrays is TRUE?

a)

Arrays can contain items of different data types

b)

Arrays can only contain items of a single data type

c)

Lists and arrays are the same thing

d)

An arrays is a type of variable

8.

Arrays are an example of...

a)

Dynamic Data Structures

b)

Static Data Structures

c)

Strings

d)

Integers

9.

A programmer is creating a simple grid based video game. The blue square represents start position of the player, which is stored in a 2D array. Which of the following is correct?

a)

Player_pos = [1,5]

b)

Player_pos=[2,5]

c)

Player_pos=[5,1]

d)

Player_pos=[5,2]

10.

Fruits = ["Apple","Pear","Orange","Grape","Pineapple",'Pen"]

What will be displayed if I type in:

print(Fruits[2])

a)

Orange

b)

Apple

c)

Pear

d)

Grape

11.

When talking about lists, what does append mean?

a)

Add a value to the end of a list

b)

Add a value to the begining of a list

c)

Add the word pen to a list

d)

Print out the list

12.

prime_numbers = [2, 3, 5, 7, 9, 11]

prime_numbers.remove(9)

print(prime_numbers)

What would be displayed?

a)

2,3,5,7,11

b)

2,3,5,7,9,11

c)

2,1,3,5,7,9,11

d)

2,3,5,7,9,11,9

13.

Which of these is the correct code for creating a list of names?

a)

nameList = John, Harry, Jesse, John, Harry, Harry

b)

nameList = ("John", "Harry", "Jesse", "John", "Harry", "Harry")

c)

nameList = ["John", "Harry", "Jesse", "John", "Harry", "Harry"]

d)

nameList = [John, Harry, Jesse, John, Harry, Harry]

14.
Which sorting algorithm is described by: moving through a list repeatedly, swapping elements that are in the wrong order. 
a)
Merge
b)
Bubble
c)
Insertion
d)
None of the above
15.
Which of the following is not a sorting algorithm? 
a)
Bubble
b)
Insertion
c)
Binary
d)
Merge
16.
When creating the array 'scores(9)', what does the '9' in brackets represent?
a)
The number of elements the array can hold
b)
The largest number of digits an element can hold
c)
The largest number of characters an element can hold
17.

The following two lists are to be merged, which element first goes into the

new merged list?

List 1: 2 4 8 9

List 2: 1 6 8 4

a)

0

b)

1

c)

2

d)

3

18.

Which sorting algorithm splits a list of items into individual lists?

a)

Merge

b)

Bubble

c)

Insertion

d)

None of these

19.

Which sorting algorithm takes an item from the list, and puts it in the correct place in a sorted list?

a)

Merge

b)

Bubble

c)

Insertion

d)

None of these

20.
Which type of sort algorithm is this?
a)
Insertion
b)
Merge
c)
Bubble