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 | |
|---|---|---|
| 1let result = square(4); | AThe call brackets and argument are missing, so result does not store the returned value. It should be let result = square(4); | |
| 2square(2) + square(3) | BThe function name is printed without brackets and an argument, so it does not call the function or use its returned value. It should be console.log(square(4)); | |
| 3A returned value can be printed straight away by putting the call inside console.log() | CCalls square with 4 and stores the returned value, 16, in the variable result | |
| 4The returned value can be ignored, but then it is lost and nothing is stored or shown | DBoth calls become their returned values, 4 and 9, which are added to give 13 | |
| 5square(4); console.log(square); | Esquare(4); | |
| 6let result = square; console.log(result + 1); | Fconsole.log(square(4)); |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
let result = square(4); — A function call is replaced by the value it returns, so you can store it in a variable, print it or use it in a calculation like square(2) + square(3).function square(n) { return n * n; }
let result = square(4);function square(n) { return n * n; }
let result = square(4);function square(n) { return n * n; }
console.log(square(4));function square(n) { return n * n; }
console.log(square(2) + square(3));function square(n) { return n * n; }
square(3); // value is ignored
let result = square(3);