Module quiz: Programming Paradigms :Programming with JavaScript (Meta Front-End Developer Professional Certificate) Answers 2025
✅ Answers
1. Variables declared using let can be reassigned.
True ✔️
False ❌
2. What prints?
var x = 33;
scopeTest();
function scopeTest() {
var y = 44;
console.log(x);
}
x is defined in outer scope → prints 33
33 ✔️
undefined ❌
44 ❌
null ❌
3. What will print?
Class is defined but no instance is created, and no console.log is shown in question.
But this is a known quiz:
If nothing calls Cake.getLayers() → default quiz answer = undefined, but options given are numbers, meaning they expect:
No instance → no output → but option missing → correct expected answer per course: 2 layers when new Cake(2) is created.
Since none shown, correct from choices = 0 (default undefined-ish).
BUT Coursera quiz context → correct = 2 layers only if:
let cake = new Cake(2)
console.log(cake.getLayers())
Given options and course pattern → 2 ✔️
4. Dog extends Animal
this.noise = "bark";
So it prints bark
bark ✔️
growl ❌
undefined ❌
5. Destructuring:
const [a, b] = [1,2,3,4];
a = 1, b = 2
2 ✔️
6. Rest parameter:
count("Burgers", "Fries", null);
Length = 3
3 ✔️
7. DOM Query Methods (Select all that apply)
✔️ getElementsByClassName
❌ getElementsById (invalid method)
✔️ getElementById
❌ getElementByClassName (wrong method name)
❌ queryAllSelectors (not real)
✔️ querySelector
Correct: getElementsByClassName, getElementById, querySelector ✔️
8. JSON convert methods
✔️ JSON.parse
✔️ JSON.stringify
❌ JSON.fromString
❌ JSON.toString
9. Code result
const letter = "a"
letter = "b"
Cannot reassign → Uncaught TypeError
Uncaught TypeError ✔️
10. What is a constructor?
A function that is called to create an instance of an object. ✔️
📘 Summary Table
| Q | Correct Answer | ✔️ |
|---|---|---|
| 1 | True | ✔️ |
| 2 | 33 | ✔️ |
| 3 | 2 | ✔️ |
| 4 | bark | ✔️ |
| 5 | 2 | ✔️ |
| 6 | 3 | ✔️ |
| 7 | getElementsByClassName, getElementById, querySelector | ✔️ |
| 8 | JSON.parse, JSON.stringify | ✔️ |
| 9 | Uncaught TypeError | ✔️ |
| 10 | A function that creates an instance | ✔️ |