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 >= 50) { } else { } | Aif (age < 13) { } else if (age < 18) { } else { } | |
| 2if (a === 5 && b === 2) | BA single = assigns a value instead of comparing. The = block in a hexagon should become === in the condition. | |
| 3A nested if-else block (an if-else placed in the else part) becomes an else if chain | CAn 'and' block joining two = checks becomes && with === comparisons | |
| 4A 'not' block around a condition becomes ! in front of it, and an 'or' block becomes || | DThe condition is missing its round brackets. The hexagon condition must be written inside ( ) after if. | |
| 5if (score = 50) { | EThe visual if-else block as JavaScript: the hexagon condition goes in brackets and each branch's steps go inside curly braces | |
| 6if score >= 50 { | Fif (!raining || hasCoat) |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
if (score >= 50) { } else { } — A visual if-else block becomes if/else code. The hexagon condition goes in brackets as a comparison, and the steps from each part of the block go inside curly braces.if (score >= 50) {
console.log("Pass");
}if (temp > 30) { console.log("Hot"); }
else { console.log("Cool"); }if (answer === 7) {
console.log("Correct!");
}if (age >= 10 && age <= 12) {
console.log("Allowed");
}if (score >= 80) { grade = "A"; }
else if (score >= 50) { grade = "B"; }
else { grade = "C"; }