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 Count ← 2 TO 10 STEP 2 | AFOR Number ← 10 TO 0 STEP -1 | |
| 2FOR Count ← 5 TO 1 STEP -1 | BThe step is negative, so the value goes down from 1 and never reaches 9. It should be STEP 2 to count up in twos. | |
| 3To count down from 10 to 0 in a FOR loop, the step must be negative | CCount goes 5, 4, 3, 2, 1 because the negative step makes it decrease by 1 each time | |
| 4To output only the even numbers from 2 to 20, the loop uses a step of 2 | DFOR Number ← 2 TO 20 STEP 2 | |
| 5FOR Count ← 10 TO 1 STEP 1 | EThe loop is meant to count down, but STEP 1 makes the value go up, so it moves away from the end value. It should use STEP -1. | |
| 6FOR Count ← 1 TO 9 STEP -2 | FCount goes 2, 4, 6, 8, 10 because the step makes it increase by 2 each time |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
STEP — Used in a FOR loop to set how much the loop variable changes each time. STEP 2 counts in twos and STEP -1 counts down. The loop stops when the value goes past the end.FOR Count ← 0 TO 10 STEP 2
OUTPUT Count
NEXT CountFOR Count ← 10 TO 1 STEP -1
OUTPUT Count
NEXT CountFOR Num ← 2 TO 10 STEP 2
OUTPUT Num
NEXT NumFOR Count ← 5 TO 1 STEP -1
OUTPUT Count
NEXT CountFOR Count ← 20 TO 0 STEP -5
OUTPUT Count
NEXT Count