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 | |
|---|---|---|
| 1Diamond: count < 3? Yes -> back to the step before | AThe exit arrow: when the test fails, leave the loop and carry on to the output | |
| 2Diamond: count < 3? No -> Output count | BEach time the Yes arrow loops back to the diamond, add a new row to the trace table for that pass | |
| 3The counter is updated before the test, so the diamond sees the new value each time it is visited | CStart count <- 0: visits with count 1, 2, 3 for count < 3? | |
| 4The diamond is visited once per pass, plus one final visit that takes the exit arrow | DA row was missed for a visit to the diamond. Every time the loop-back arrow returns to the diamond, a new row must be added. | |
| 5Trace rows: count 1 | count 2 (loop-back arrow followed, but no row added for the third visit) | EThe test was read wrongly. 3 < 3 is false, so the No arrow should be taken and the flowchart should exit the loop. | |
| 6count = 3: count < 3? is Yes, so loop back again | Fcount <- count + 1 then diamond: count < 3? |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
loop-back arrow — An arrow that returns to a decision diamond. Each time you follow it, add a new row to the trace table so every pass of the loop is recorded, until you take the exit arrow.Start: count ← 0
Step: count ← count + 1
Diamond: count < 3 ?Step: count ← count + 1
Diamond: count < 3 ? Yes → loop backStart: count ← 0. Step: count ← count + 1
Diamond: count = 3 ? Yes → exit
Diamond is visited 3 timesDiamond: count < 3 ? Yes → loop back
Each pass of the loop adds a new rowRow 3: count ← 3
Diamond: count < 3 ? No → exit arrow