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 (age > 13) { | Aif (answer === 7) { | |
| 2let area = width + height; | Bif (mark >= 50) { | |
| 3Using >= so that a mark of exactly 50 counts as a pass fixes a boundary logic error | Cprompt() gives back text, so + joins the text and 5 together ("35") instead of adding. The text should be converted with Number() first. | |
| 4Use === to compare two values, because a single = assigns a value instead of comparing | DRuns with no error but leaves out a person who is exactly 13, which is a logic error if 13 should be allowed | |
| 5if (guess = 7) { | EA single = assigns 7 to guess, so the condition is always true. There is no error message, but the answer is wrong. It should be ===. | |
| 6let total = prompt("Number?") + 5; | FRuns with no error but adds instead of multiplying, so the area is wrong. This is a wrong-operator logic error |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
logic error — A mistake that lets the program run with no error message but gives a wrong result, such as using > instead of >=, the wrong operator, or steps in the wrong order.let score = 50;
if (score >= 50) console.log("Pass");let price = 8;
let total = price * 3;
console.log(total);let pin = 1234;
if (pin === 1234) console.log("Open");let age = prompt("Age?");
let next = Number(age) + 1;
console.log(next);let a = 80;
let b = 90;
let avg = (a + b) / 2;