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 | |
|---|---|---|
| 1console.log("total:", total); | AA comma is missing between the label and the variable, so this is a syntax error and nothing is logged. It should be console.log("total:", total); | |
| 2console.log("n =", n, "result =", result); | Bfor (let i = 0; i < 5; i++) { console.log("i:", i); } | |
| 3Log the counter inside a loop to see how its value changes on every repeat | CThe variable total is inside the quotes, so only the word is printed, not the value. It should be console.log("total:", total); | |
| 4Once the bug is fixed, remove or comment out the debug line so the console stays clean | D// console.log("score:", score); | |
| 5console.log("total:" total); | ELogs a function's parameter and its result together so you can see what went in and what came out | |
| 6console.log("total:"); | FPrints a labelled value of total so you can check what it holds at that point in the program |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
console.log("total:", total) — Prints a labelled variable value while the program runs, so you can spot the line where the value first goes wrong. Remove these debug lines once the bug is fixed.let total = 0;
total = total + 5;
console.log("total:", total);for (let i = 1; i <= 3; i++) {
console.log("i:", i);
}function double(n) { return n * 2; }
const result = double(4);
console.log("result:", result);function greet(name) {
console.log("name:", name);
}let score = 0;
score += 5;
// console.log("score:", score);