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 age = prompt("Enter your age"); | AThe pseudocode step ASK for name is an input, so it should use prompt(), not console.log(), which only displays output. | |
| 2while (lives > 0) { | Bif (score >= 10) { | |
| 3The pseudocode step SET total TO 0 becomes a variable declaration with let. | CTranslates a decision diamond with an arrow looping back: while lives is more than 0, repeat the steps inside. | |
| 4A decision diamond that asks 'Is score >= 10?' becomes an if statement with the same condition. | Dlet total = 0; | |
| 5if (score = 10) { | ETranslates a parallelogram input step: INPUT age. The answer from the user is stored in the variable age. | |
| 6let name = console.log("Enter your name"); | FThe diamond asks 'Is score equal to 10?' but the code uses = which assigns a value. It should use === to compare. |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
let score = 0; — Translates the pseudocode step SET score TO 0. Each step of pseudocode or a flowchart becomes one JavaScript statement: ask is prompt, a decision diamond is if, a loop arrow is while.// SET score TO 0
let score = 0;// ASK "Your name?"
let name = prompt("Your name?");if (score > 10) {
console.log("Well done!");
}while (lives > 0) {
lives--;
}let total = 5 + 3;
console.log(total);