Tip: Choose Save as PDF in the print dialog to download. Use A4 paper size.
Shade in the A or B circle for each question.
Draw a line connecting each item on the left to its match on the right.
| Left column | Right column | |
|---|---|---|
| 1Inputs 4, 7, 2 give Total = 13 | AThe output is the sum of the inputs, so the purpose is totalling | |
| 2Inputs 4, 7, 2 give Max = 7 | BIF Mark >= 50 THEN Count ← Count + 1 | |
| 3A counting algorithm adds 1 to a counter only when a condition is true, so the output is how many values passed | COne set of test values is not enough as 9 could also be the middle value or the last input checked, so try two or three different inputs | |
| 4A search algorithm compares each item with the target and outputs whether it was found | DThe output is the biggest input, so the purpose is finding the largest | |
| 5Inputs 3, 5, 8 give Total = 16, so it counts the values | EThe output 16 is the sum of the inputs, not how many there were (3), so the purpose is totalling, not counting | |
| 6One test of 2, 9, 5 gives 9, so it must find the largest | FIF Item[Index] = Target THEN Found ← TRUE |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
dry run — Running an algorithm by hand with test values, then comparing the inputs with the final outputs to work out its purpose, such as totalling, counting or finding the largest.Total ← 0
Total ← Total + Number
OUTPUT Total // inputs 4, 6 output 10IF Mark > 50 THEN
Count ← Count + 1
ENDIFIF Number > Largest THEN
Largest ← Number
ENDIFIF Names[Index] = Target THEN
Found ← TRUE
ENDIFFOR Count ← 1 TO 3
Total ← Total + Count
NEXT Count