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 | |
|---|---|---|
| 1FOR Number <- 0 TO 100 STEP 10 | ACounts down from 10 to 1, taking away 1 each repeat, giving 10 repeats | |
| 2FOR Count <- 10 TO 1 STEP -1 | BSTEP must be followed directly by the step value. The extra = sign is not valid in Cambridge pseudocode. | |
| 3If STEP is left out, the counter goes up by 1 each repeat | CCounts up in tens: 0, 10, 20 and so on up to 100, giving 11 repeats | |
| 4A negative STEP is needed when the start value is bigger than the end value | DFOR Lap <- 8 TO 2 STEP -2 | |
| 5FOR Count <- 10 TO 1 OUTPUT Count NEXT Count | EFOR Index <- 1 TO 5 | |
| 6FOR Number <- 0 TO 100 STEP = 10 | FThere is no STEP -1, so the counter goes up by 1 by default. The start (10) is already past the end (1), so the loop body never runs. |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
FOR Count <- 10 TO 1 STEP -1 — STEP sets how much the FOR counter changes each repeat. Without STEP the counter goes up by 1. A negative STEP, such as -1, makes the counter count down.FOR Number <- 0 TO 100 STEP 10
OUTPUT Number
NEXT NumberFOR Count <- 10 TO 1 STEP -1
OUTPUT Count
NEXT Count// Outputs 0, 20, 40, 60, 80, 100
FOR Number <- 0 TO 100 STEP 20
NEXT Number// Same as having no STEP at all
FOR Index <- 1 TO 10 STEP 1
NEXT Index// Repeats 6 times: 0, 10, 20, 30, 40, 50
FOR Count <- 0 TO 50 STEP 10
NEXT Count