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 | |
|---|---|---|
| 1count <- count + 1 | AAn accumulator: adds the value of score to a running total each time the loop repeats | |
| 2total <- total + score | BThe accumulator adds 1 instead of the value being collected, so it only counts repeats. It should be total <- total + x. | |
| 3Set the counter to 0 before the loop so it starts from nothing | Cfor i from 1 to 5 if mark >= 50 then passes <- passes + 1 end if end for | |
| 4Count only the matches: add 1 only when a condition is true | Dcount <- 0 for i from 1 to 10 count <- count + 1 end for | |
| 5for i from 1 to 10 count <- 0 count <- count + 1 end for | EA counter: adds 1 to count each time the loop repeats | |
| 6total <- 0 for i from 1 to 5 total <- total + 1 end for | Fcount is set to 0 inside the loop, so it resets every repeat and always ends at 1. Move count <- 0 to 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.
count <- count + 1 — A counter. It adds 1 to a variable each time a loop repeats. Set it to 0 before the loop. An accumulator works the same way: total <- total + x adds a value each time.count <- 0
for i from 1 to 10
count <- count + 1total <- 0
for i from 1 to 5
total <- total + ifor i from 1 to 5
input score
if score > 50 then count <- count + 1total <- 0
for i from 1 to 4
total <- total + icount <- 0
while count < 5
count <- count + 1