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 | |
|---|---|---|
| 1if score > 10 then for i from 1 to 3 print i | AThe loop is inside the else branch, so it only runs when the if condition was false | |
| 2else while lives > 0 lives <- lives - 1 | BThe loop is not indented under then, so it is outside the if block and runs no matter what the condition is | |
| 3If the condition is false, the loop in the true branch is skipped completely | CThe loop is inside the true branch, so it only runs when score is bigger than 10 | |
| 4A loop can sit in the else branch and run only when the condition is false | Dif x > 0 then for i from 1 to x print i | |
| 5if x > 0 then print "Positive" for i from 1 to x print i | EThe loop is in the else branch, but x is only positive in the true branch, so the loop will never run properly | |
| 6if x > 0 then print "Positive" else for i from 1 to x print i | Fif age >= 13 then print "Teen" else for i from 1 to 3 print "Kid" |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
if x > 0 then for i from 1 to x — A loop written inside an if branch only runs when that branch's condition is true. If the condition is false, the loop is skipped. An else branch can hold a loop too.if score > 50 then
for i from 1 to 3
print "Pass"if x > 0 then
for i from 1 to x
print ielse
for i from 1 to 3
print "Low"if age >= 13 then
for i from 1 to 3
print "Hi"if x > 0 then
for i from 1 to x
print i