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 | |
|---|---|---|
| 1const rex = new Dog('Rex', 3); | AMakes a new Track object using the Track class and saves it in song | |
| 2const song = new Track('Wave', 210); | BThe keyword new is missing. Calling a class without new causes an error, so no object is created. | |
| 3Put the keyword new before the class name to create an object from a class | CThe new object is not stored in a variable, so the program has no way to use it again later. | |
| 4The arguments in the brackets are passed to the constructor, in the same order as its parameters | DCreates a Dog object, sends 'Rex' and 3 to the constructor, and stores the object in the variable rex | |
| 5const rex = Dog('Rex', 3); | Econst pet = new Dog('Bella', 5); | |
| 6new Dog('Rex', 3); | Fconst rex = new Dog('Rex', 3); |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
new ClassName(arguments) — Creates an object from a class and passes the arguments to the constructor. Store it in a variable, e.g. const rex = new Dog('Rex', 3). Leaving out new causes an error.const rex = new Dog('Rex', 3);const rex = new Dog('Rex', 3);const rex = new Dog('Rex', 3);
console.log(rex.name);const rex = new Dog('Rex', 3);let bo = new Dog('Bo', 5);
console.log(bo.name);