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 | |
|---|---|---|
| 1day === "Sat" || day === "Sun" | Ascore === 0 || score === 100 | |
| 2false || false | BGives false, because || is false only when both sides are false | |
| 3Either one of two conditions is enough to make the whole condition true | Cconsole.log(5 > 10 || 2 > 8); | |
| 4|| gives false only when both conditions are false | DOR is written with two vertical bars ||. A single | is a different operator. | |
| 5if (day === "Sat" || "Sun") { | EThe right side of || is just the text "Sun", not a comparison. Each side of || needs its own full condition. | |
| 6if (day === "Sat" | day === "Sun") { | FTrue when the day is Saturday or Sunday, so it is true on the weekend |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
logical OR — Logical OR joins two conditions. It is true when at least one is true, and false only when both are false. Example: day === 'Sat' OR day === 'Sun' is true on a weekend.let off = day === "Sat" || day === "Sun";if (day === "Sat" || day === "Sun") {
console.log("Weekend!");
}let hasPass = false;
let hasTicket = true;
let canEnter = hasPass || hasTicket;if (score < 0 || score > 100) {
console.log("Invalid");
}let isSat = day === "Sat";
let isSun = day === "Sun";
let off = isSat || isSun;