Font size
WorksheetsNEW_SMP_Mls8_Quiz
Total questions: 18
Worksheet time: 11mins
What is an Algorithm?
A chart showing the flow of a series of events
A decision arrived at by following instructions
Step-by-step instructions used to solve a problem
A computer program that follows a chart
Which of the following is NOT an algorithm?
What should be considered when designing an algorithm?
If the correct hardware is being used
If the correct software is being used
If there is more than one way of solving the problem
Which of these pseudocode algorithms matches this flowchart?
input a
b <- 1
c <- 1
IF (a>1)
d <- b + c
c <- b
d <- c
a <- a - 1
ENDIF
output c
input a
b <- 1
WHILE (a>1)
d <- b + c
c <- b
d <- c
a <- a - 1
ENDWHILE
output c
input a
b <- 1
c <- 1
WHILE (a>1)
d <- b + c
b <- c
c <- d
a <- a - 1
ENDWHILE
output c
input a
b <- 1
c <- 1
IF (a>1)
d <- b + c
b <- c
c <- d
a <- a - 1
ENDIF
output c
Some pseudocode to manipulate a numeric list is given below:
input list
a <- first_item_in_list
WHILE NOT end of list
b <- next item in the list
IF a > b
a <- b
ENDIF
ENDWHILE
output a
average(list)
max(list)
min(list)
search list for a
A bubble sort algorithm will loop until?
We have completed an entire run of comparing each item with the next in the list, and have made no changes during the run.
We have compared each item with the item next to it and swapped them if needed.
We have compared each item with each other item.
We have made a number of swaps equal to the number of items in the list.
Which sorting algorithm may make multiple swaps per pass?
Bubble Sort
Merge Sort
Insertion Sort
Which sorting algorithm relies on the Divide and Conquer strategy?
Merge Sort
Bubble Sort
Insertion Sort
Which of the following is not a sorting algorithm?
Binary
Linear
Merge
Bubble
Which sorting algorithm is described by: moving through a list repeatedly, swapping elements that are in the wrong order.
Merge
Insertion
Bubble
None of the above
How does Bubble Sort generally compare to Merge Sort?
It is more efficient
It is less efficient
It is equally efficient
Which type of lists or data sets are linear searching algorithms used for?
Unsorted lists or data sets
Sorted lists or data sets
Select the best description to explain what a linear search algorithm is.
Elements do not need to be in order, compare to the middle value, split the list in order, and repeat
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.
Select the best description to explain what a binary search algorithm is.
Put the elements 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
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.
Describe an advantage of a linear search algorithm
Data does not need to be in order.
Can only work on an ordered list. If unordered must use a linear search.
Slow with large data sets.
Performs well over large ordered lists.
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?
1
2
3
4
A binary search is to be performed on the list:
[1, 5, 10, 13, 48, 68, 100, 101]
How many comparisons would it take to find number 101?
0-1
1-2
3-4
4-5
Describe an advantage of a binary search algorithm
Data does not need to be in order.
Can only work on an ordered list. If unordered must use a linear search.
Slow with large data sets.
Performs well over large ordered lists.
