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 avg = (a + b) / 2; | AWorks left to right because - is on the same level, so it does 20 - 6 = 14 and then 14 - 4 = 10. | |
| 2let result = 20 - 6 - 4; | BThe * runs before the +, so the answer is 16, not 36. It needs brackets: (10 + 2) * 3. | |
| 3Nested brackets: JavaScript works out the innermost brackets first, then works outwards. | Clet total = (2 + (3 * 4)) * 5; | |
| 4Without brackets, * and / run before + and -, so only the last number is divided. | DAdds a and b first because of the brackets, then divides the total by 2 to get the average. | |
| 5let avg = math + english / 2; | Elet avg = a + b / 2; | |
| 6let answer = 10 + 2 * 3; // should be 36 | FThere are no brackets, so only english is divided by 2 and then math is added. It should be (math + english) / 2. |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
(a + b) / 2 — Brackets run first, so a + b is added before dividing by 2. Then * and /, then + and -. Operators on the same level go left to right. Without brackets, only b is divided by 2.let a = 6;
let b = 10;
let average = (a + b) / 2;console.log((4 + 6) / 2); // 5let result = 2 * ((3 + 5) - 1); // 14let x = 20 / 5 * 2; // 8let mark = (90 + 72 + 84) / 3; // 82