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('price:', price); | Afunction area(w, h) { console.log('w:', w, 'h:', h); } | |
| 2for (let i = 0; i < 3; i++) { console.log('i:', i); } | BThe values are logged without labels, so the output shows two bare numbers and you cannot tell which is score and which is lives. | |
| 3Log a parameter on entry to a function to check what value the function actually received | CLogs the value of i on every pass of the loop, so you can watch how it changes each time. | |
| 4Once the bug is fixed, remove the temporary debugging line so the console stays clean | DThe closing bracket is missing, so this is a syntax error and nothing is logged. | |
| 5console.log(score); console.log(lives); | EPrints the label 'price:' and the value of price, so you can see what the variable holds at that moment. | |
| 6console.log('total: ' + total; | Ffunction total(a, b) { return a + b; } |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
console.log(label, value) — A temporary line that prints a variable's value while the program runs, so you can see where it goes wrong. Add a label to tell values apart, then remove it once fixed.function square(n) {
console.log("n:", n);
return n * n; }for (let i = 0; i < 3; i++) {
console.log("i:", i);
}let score = 10 * 2;
console.log("score:", score);let sum = 0;
for (const n of nums) sum += n;
console.log("sum:", sum);let x = 4 * 5;
// console.log("x:", x);