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 | |
|---|---|---|
| 1!true | Alet failed = !(mark >= 50); | |
| 2!(score >= 50) | BThe ! is placed before score only, not before the whole bracketed comparison. It flips score first, not the result of score >= 50. | |
| 3Put ! before brackets to reverse the result of a whole comparison | Clet isOpen = !isClosed; | |
| 4Reading ! as 'not': let isOpen be the opposite of isClosed | DGives false, because ! reverses the boolean value | |
| 5if (!score >= 50) { | E!false reverses false into true, not false. The programmer forgot that ! flips the value. | |
| 6let isNight = !false; // want false | FTrue when score is NOT 50 or more, so score is below 50 |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
! — The not operator. It reverses a boolean: !true is false and !false is true. Put it before a value or bracket, like !(score >= 50). Read it as 'not'.console.log(!true);let isDone = false;
console.log(!isDone);let score = 40;
let failed = !(score >= 50);
console.log(failed);let isOpen = true;
let isClosed = !isOpen;
console.log(isClosed);let raining = false;
if (!raining) console.log("Go outside");