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 row FROM 1 TO 3 FOR col FROM 1 TO 2 DISPLAY col END FOR END FOR | AFOR row FROM 1 TO 3 FOR col FROM 1 TO 2 | |
| 2Two matching END FOR keywords, one for each loop | BA nested FOR loop with an outer and inner loop, each with its own variable | |
| 3A loop structure where the inner loop completes fully for each outer pass | CRequired to properly close both the inner and outer loops | |
| 4Distinct variables, such as row and col, used for the outer and inner loops | DThe inner loop should use a different variable name than the outer loop | |
| 5FOR row FROM 1 TO 3 FOR row FROM 1 TO 2 DISPLAY row END FOR END FOR | EA second END FOR is needed to close the outer loop as well | |
| 6FOR i FROM 1 TO 3 FOR j FROM 1 TO 2 DISPLAY j END FOR | FNested FOR loop |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
Nested FOR loop — A FOR loop placed entirely inside another FOR loop, so the inner loop runs fully for every repetition of the outer loopFOR row FROM 1 TO 3
FOR col FROM 1 TO 2FOR row FROM 1 TO 3
FOR col FROM 1 TO 2
DISPLAY col
END FORFOR row FROM 1 TO 3
FOR col FROM 1 TO 2
DISPLAY col
END FOR
END FORFOR i FROM 1 TO 3
FOR j FROM 1 TO 2The inner loop runs fully for each cycle of the outer loop