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 score = 5; score = score + 2; console.log(score); | Aconsole.log("Go!"); console.log("Ready"); | |
| 2console.log("A"); console.log("B"); | BRuns top to bottom: score is set to 5, then changed to 7, then 7 is printed | |
| 3A variable must be set before it is used, so its line goes above the line that uses it | CThe variable lives is used on line 1 before it is set on line 2. The lines are in the wrong order, so this causes an error. | |
| 4Swapping two lines changes the output because the lines still run from top to bottom | DThe student expects 10 to be printed, but console.log runs before total changes, so it prints 4. | |
| 5console.log(lives); let lives = 3; | Elet age = 13; console.log(age); | |
| 6let total = 4; console.log(total); total = total + 6; | FPrints A first and then B, because the first line runs before the second |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
sequence — Statements run one after another from top to bottom, so changing the order of lines can change the result. A variable must be set before it is used.let score = 5;
score = score + 2;
console.log(score);let total = 10;
console.log(total);let n = 4;
n = n * 3;
console.log(n);let price = 20;
let total = price * 2;
console.log(total);let step = 1;
step = step + 1;
console.log(step);