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 | |
|---|---|---|
| 1Total ← 0 | AAdds the current value to the running total, replacing Total with the new, larger total | |
| 2Total ← Total + Value | BInitialises the running total to zero before the loop starts, so nothing is left over from earlier | |
| 3Add each number typed in by the user to the total inside a loop | CFOR Count ← 1 TO 5 INPUT Number Total ← Total + Number NEXT Count | |
| 4Show the final total only once, after the loop has finished | DTotal is assigned each array element instead of adding to itself, so it only holds the last element. It should be Total ← Total + Number[Index]. | |
| 5FOR Count ← 1 TO 5 Total ← 0 INPUT Number Total ← Total + Number NEXT Count | ENEXT Count OUTPUT Total | |
| 6FOR Index ← 1 TO 5 Total ← Number[Index] NEXT Index | FTotal is set to 0 inside the loop, so it is reset on every pass and the running total is lost. Move Total ← 0 before the loop. |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
Total ← Total + Value — Totalling builds a running total. Set Total ← 0 before the loop, add each Value to Total inside the loop, then OUTPUT Total after the loop has finished.Total ← 0
FOR Count ← 1 TO 5
INPUT ValueFOR Count ← 1 TO 5
INPUT Value
Total ← Total + ValueFOR Index ← 1 TO 5
Total ← Total + Marks[Index]
NEXT Index Total ← Total + Value
NEXT Count
OUTPUT "Total is ", TotalREPEAT
INPUT Value
Total ← Total + Value