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 | |
|---|---|---|
| 1age >= 18 ? "adult" : "minor" | AReturns "win" if score is over 50, otherwise "lose" | |
| 2score > 50 ? "win" : "lose" | B: | |
| 3A shorthand way of writing an if/else statement | CWrong - use :, not -, between the two values | |
| 4Separates the true and false results in a ternary | Dcondition ? valueIfTrue : valueIfFalse | |
| 5let x = a = "yes" : "no"; | EReturns "adult" if age is 18 or more, otherwise "minor" | |
| 6let y = a ? "yes" - "no"; | FWrong - use ?, not =, after the condition |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
?: — A shorthand operator that returns one value if a condition is true and another if false, without needing if/else.let status = age >= 18 ? "adult" : "minor";let result = score > 50 ? "win" : "lose";let label = isReady ? "Go" : "Wait";let output = temp > 30 ? "hot" : "cool";let grade = pass ? "Pass" : "Fail";