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 | |
|---|---|---|
| 1Max ← Number[1] FOR Index ← 2 TO 10 IF Number[Index] > Max THEN Max ← Number[Index] NEXT Index OUTPUT Max | AThis only names the programming constructs used. It does not say what the algorithm achieves, and it ignores the OUTPUT and identifier names. | |
| 2Total ← 0 FOR Count ← 1 TO 5 INPUT Mark Total ← Total + Mark NEXT Count OUTPUT Total / 5 | BTotalCost ← TotalCost + Price | |
| 3Start from the OUTPUT: the value that is output shows what the algorithm is trying to achieve. | CThis is a line-by-line description of the steps, not the purpose. It does not say what the whole algorithm achieves. | |
| 4Clues in identifier names: meaningful names hint at the purpose of an algorithm. | DPurpose: calculates the average of five marks entered by the user. | |
| 5Purpose: Sets Total to 0, then adds each Mark to Total in a loop. | EOUTPUT PassCount | |
| 6Purpose: Uses a FOR loop and an IF statement. | FPurpose: finds the largest of ten numbers stored in an array. |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
purpose — What the whole algorithm achieves, stated in one sentence, such as 'finds the largest of ten numbers'. It is not a line-by-line description. Check the OUTPUT and identifier names for clues.// Purpose: finds the largest number
IF Number > Largest THEN Largest ← NumberTotal ← Total + Mark
Average ← Total / 5
OUTPUT "Average mark: ", AverageIF Age >= 18 THEN
AdultCount ← AdultCount + 1
ENDIFProcess: Remainder ← Number MOD 2
Decision: Remainder = 0?
Output: "Even"FOR Count ← 1 TO 10
INPUT Number
Total ← Total + Number