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 | |
|---|---|---|
| 1ReferenceError: score is not defined | AThe name totl is misspelt, so JavaScript cannot find a variable with that name | |
| 2let score = 5; console.log(Score); | Bconsole.log(lives); let lives = 3; | |
| 3Using a variable outside the block where it was declared with let causes a ReferenceError | Cif (true) { let bonus = 10; } console.log(bonus); | |
| 4Using a variable before declaring it can cause a ReferenceError | DThe variable is declared as playerName but used as playername, so the capital N is missing and the name is not defined | |
| 5let playerName = 'Mia'; console.log(playername); | ECauses a ReferenceError because Score with a capital S is a different name from score | |
| 6let total = 4; console.log(totl); | FThe program used the name score, but no variable or function called score has been declared |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
ReferenceError — An error shown when code uses a variable or function name that has not been declared, often from a typo, wrong capital letter, wrong scope or using it before declaring it.let coins = 10;
console.log(coins);let speed = 9;
console.log(speed);let msg = "";
if (true) { msg = "Hi"; }
console.log(msg);function sayHi() { console.log("Hi"); }
sayHi();let score = 0;
score = score + 1;
console.log(score);