WorksheetsAlgorithms
Total questions: 35
Worksheet time: 19mins
HINT: Same as Python
12 6 8 1 3
What will the list look like after the first iteration through the list?
The following two lists are to be merged, what would be the correct first step?
List 1
2 4 8 9
List 2
1 6 8 4
Compare 2 and 4 and put 2 into a new list
Compare 2 and 1 and put 1 into a new list
Compare 1 and 6 and put 1 into a new list
Compare 9 and 4 and put 4 into a new list
Identify the description of a binary search
Put the elements in order, check each item in turn
Take an ordered list, compare the search value to the middle value, if it's higher than the middle take the right side of the list otherwise take the left 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
The following algorithm should take an input and add together two numbers, outputting the result.
Identify the correct algorithm
Num1=input("Enter the first number")
Num2=input("Enter the second number")
num3=num1+num2
print(Num3)
num1=input("Enter the first number")
num2=input("Enter the second number")
num3=num1+num2
print(num3)
num1=input("Enter the first number")
num3=input("Enter the secon number")
num3=num1+num2
print(num3)
num1=input("Enter the first number")
num2=input("Enter the second number")
num3=num1+num2
print(num2)
The following algorithm should take a numerical input, and output the 1 to 12 times table for that number.
Identify the correct algorithm
number=input("Enter a number")
for x = 1 to 12
print(number*x)
next x
number=input("Enter a number")
for x = 0 to 12
print(number * x)
next x
number=input("Enter a number")
for x = 1 to 12
print(number X x)
next x
number=input("Enter a number")
for x = 1 to 12
print(number*number)
next x
number = input(“Enter the second number”)
final = (((number + number) * 11) + 4) / 2
print(final)
final = (((number + number2) * 11) + 4) * 2
print (final)
number2 = input(“Enter the second number”)
final = number + number2 +4 *11 / 2
print (final)
number2 = input(“Enter the second number”)
final = (((number + number2) * 11) + 4) / 2 print (final)
Which sorting algorithm is the fastest for a very unordered list?
Bubble
Merge
Insertion
Binary
Which sorting algorithm is the fastest for a list that is in the correct order?
Bubble
Merge
Insertion
Binary
Which key word will return the remainder of a division
DIV
MOD
SHOW
TCP
