Tip: Choose Save as PDF in the print dialog to download. Use A4 paper size.
This Pseudocode FOR ... TO ... NEXT loop worksheet is part of the IGCSE Computer Science 0478 — 7b Decomposition and Sub-systems journey. Print it as a booklet?
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 ← 1 TO 5 | AThe statement inside the loop is not indented. The loop body should be indented, e.g. 3 spaces before OUTPUT Count. | |
| 2NEXT Count | BFOR Number ← 1 TO 10 OUTPUT "Hello" NEXT Number | |
| 3A FOR loop that counts from 1 to 3 and outputs the counter each time, with the loop body indented | CStarts a count-controlled loop where Count begins at 1 and goes up to 5, so the loop body repeats 5 times | |
| 4A FOR loop that repeats an action exactly 10 times, using the same variable name after NEXT | DFOR Count ← 1 TO 3 OUTPUT Count NEXT Count | |
| 5FOR Count ← 1 TO 5 OUTPUT Count NEXT i | ENEXT uses a different variable name (i) from the one in the FOR line (Count). It should be NEXT Count. | |
| 6FOR Count ← 1 TO 5 OUTPUT Count NEXT Count | FMarks the end of the FOR loop and adds 1 to Count before the loop checks whether to repeat again |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
FOR Count ← 1 TO 10 — A count-controlled loop that repeats the indented statements a fixed number of times, with Count going from 1 to 10. NEXT Count closes the loop and moves Count up by 1.FOR Count ← 1 TO 10
OUTPUT Count
NEXT CountFOR Count ← 1 TO 10
OUTPUT Count
NEXT CountFOR Num ← 1 TO 5
OUTPUT "Hi"
NEXT NumFOR Count ← 1 TO 3 // repeat 3 times
OUTPUT "Go"
NEXT CountFOR Num ← 1 TO 4
OUTPUT Num * 2
NEXT Num