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("expected 25, got", square(5)); | Asquare is not called. Without brackets and an input like (5), it logs the function itself instead of the result. | |
| 2console.log("expected 0, got", square(0)); | BThe actual result is typed in by hand, so the function is never called and the test proves nothing. | |
| 3Test a function with a normal input and log the expected value beside the actual output | Cconsole.log("retest: expected 25, got", square(5)); | |
| 4After fixing a bug, run the same test again to check the fix worked | DCalls square with the input 5 and prints the actual result next to the expected value 25 so you can compare them. | |
| 5console.log("expected 25, got", square); | Econsole.log("expected 36, got", square(6)); | |
| 6console.log("expected 25, got 25"); | FTests a boundary input: 0 is an edge case, and the expected result is written beside the actual result. |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
console.log("expected 25, got", square(5)) — Test a function by calling it with chosen inputs, logging the actual result next to the expected value, then recording pass or fail. Retest after any fix.console.log("expected 25, got", square(5));console.log("expected 25, got", square(5));console.log("expected 0, got", square(0));let actual = square(4);
if (actual === 16) console.log("pass");function square(n) { return n * n; }
console.log("expected 25, got", square(5));