NEW
Font size
WorksheetsAlgorithms: Revision Questions
Total questions: 20
Worksheet time: 13mins
Select the best description to explain what a binary search algorithm is.
Put the elements in order, check each item in turn.
Put the elements in order, compare with the middle value, split the list in order and repeat.
Elements do not need to be in order, check each item in turn.
Elements do not need to be in order, compare to the middle value, split the list in order and repeat
12 6 8 1 3
How many comparisons would it take to find number 1?
3 5 9 10 23
How many comparisons would it take to find number 9?
Which of these algorithms eliminates half of its possibilities each time it makes a check?
Binary search
Bubble sort
Merge sort
Linear search
If the value is not present then sequential/linear search will return
true
false
-1
the value
Which of the following facts about arrays is TRUE?
Arrays can contain items of different data types
Arrays can only contain items of a single data type
Lists and arrays are the same thing
An arrays is a type of variable
Arrays are an example of...
Dynamic Data Structures
Static Data Structures
Strings
Integers
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?
Player_pos = [1,5]
Player_pos=[2,5]
Player_pos=[5,1]
Player_pos=[5,2]
Fruits = ["Apple","Pear","Orange","Grape","Pineapple",'Pen"]
What will be displayed if I type in:
print(Fruits[2])
Orange
Apple
Pear
Grape
When talking about lists, what does append mean?
Add a value to the end of a list
Add a value to the begining of a list
Add the word pen to a list
Print out the list
prime_numbers = [2, 3, 5, 7, 9, 11]
prime_numbers.remove(9)
print(prime_numbers)
What would be displayed?
2,3,5,7,11
2,3,5,7,9,11
2,1,3,5,7,9,11
2,3,5,7,9,11,9
Which of these is the correct code for creating a list of names?
nameList = John, Harry, Jesse, John, Harry, Harry
nameList = ("John", "Harry", "Jesse", "John", "Harry", "Harry")
nameList = ["John", "Harry", "Jesse", "John", "Harry", "Harry"]
nameList = [John, Harry, Jesse, John, Harry, Harry]
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
0
1
2
3
Which sorting algorithm splits a list of items into individual lists?
Merge
Bubble
Insertion
None of these
Which sorting algorithm takes an item from the list, and puts it in the correct place in a sorted list?
Merge
Bubble
Insertion
None of these
