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 | |
|---|---|---|
| 1WHILE lives > 0 AND time > 0 DO | AD1: lives > 0? No -> exit. Yes -> D2: time > 0? No -> exit. Yes -> body -> arrow back to D1 | |
| 2REPEAT ... UNTIL score >= 10 OR lives = 0 | BDrawn as one combined diamond 'lives > 0 AND time > 0?'. Yes goes through the body and back to the diamond. No leaves the loop. | |
| 3A WHILE loop with AND can be drawn as two diamonds in a row. A No from either diamond leaves the loop, and the back arrow returns to the first diamond. | CThe back arrow returns to the second diamond, so lives > 0 is never rechecked after the first pass. It must return to the first question. | |
| 4A REPEAT...UNTIL loop with OR can be drawn as two diamonds whose Yes paths both lead to the same exit. The No path of the last diamond goes back to the start. | DA diamond after the loop body. Yes (either exit reason is true) leaves the loop. No takes the back arrow to the first step of the loop. | |
| 5D1: lives > 0? No -> exit. Yes -> D2: time > 0? No -> body. Yes -> body -> back to D1 | EThe No path of the second diamond goes to the body instead of leaving the loop, so running out of time never stops the loop. Both exit reasons must lead out of the loop. | |
| 6D1: lives > 0? Yes -> D2: time > 0? Yes -> body -> arrow back to D2 | Fbody -> score >= 10? Yes -> exit. No -> lives = 0? Yes -> exit. No -> arrow back to body |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
compound loop exit — A loop test using AND or OR is drawn as a back arrow to the first question, with one combined diamond or two diamonds. Both exit reasons must lead out of the loop.Diamond: lives > 0 AND time > 0?
Yes -> run the loop body, then back up
No -> exit the loopREPEAT
tries ← tries + 1
UNTIL guess = secret OR tries = 3Diamond 1: guess = secret? Yes -> exit
Diamond 2: tries = 3? Yes -> exit
Diamond 2 No -> back to Diamond 1WHILE NOT (score >= 50 OR lives = 0) DO
PLAY round
ENDWHILEProcess: attempts ← attempts + 1
Diamond: attempts >= 3 OR found = TRUE?
Yes -> exit, No -> back to first question