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 | |
|---|---|---|
| 1function greet(name = "Guest") { ... } | AUses "Guest" as name if no argument is passed | |
| 2function add(a, b = 0) { ... } | Bgreet("Sam") | |
| 3Provides a fallback value when no argument is given | CUses 0 as b if no argument is passed for b | |
| 4Overrides the default value when an argument is passed | DWrong - default parameters use =, not == | |
| 5function add(a, b == 0) { ... } | Ename = "Guest" | |
| 6function mul(a, b: 1) { ... } | FWrong - default parameters use =, not : |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
= — Assigns a default value to a parameter, used only when no argument is passed for it.function greet(name = "Guest") {function add(a, b = 0) {function power(base, exp = 2) {function counter(step = 1) {function scale(factor = 5) {