Final graded quiz: Programming with JavaScript :Programming with JavaScript (Meta Front-End Developer Professional Certificate) Answers 2025
✅ MCQ Answers
1. Output of the code?
a == 2 ✔️ trueb == 8 ❌ false → condition fails → else runs
✔️ Blue
❌ Green
❌ Nothing
2. Output of the code?
x = true then x = 23
✔️ 23
❌ true
3. Data type of x?
var x = "Hello" → String
✔️ String
❌ Number
❌ BigInt
❌ Boolean
4. Output of the code?
x = 10x > 10 ❌x > 5 ✔️
So output →
✔️ Pear
❌ Apple
❌ Orange
5. Output of the while loop?
Loop runs 4 times → result = 8
✔️ 8
❌ 0
❌ 2
❌ 4
6. Output of console.log(result); var result = 7;
Due to hoisting:var result becomes undefined initially
✔️ undefined
❌ null
❌ 7
7. Output of the function?
function addTwo(a,b) {
return a
}
addTwo(5,10) → returns 5
✔️ 5
❌ 10
❌ undefined
8. Output of the code?
console.log(car.mileage) → 200
✔️ 200
❌ 100
❌ 300
9. Output of veggies[2]?
Array: [‘parsley’, ‘carrot’]
Index 2 does not exist →
✔️ undefined
❌ 2
❌ 1
❌ 3
10. First argument of addEventListener?
✔️ A string describing the type of event (“click”)
❌ A function
❌ The target
11. How to create h2 element?
✔️ document.createElement(‘h2’)
❌ buildElement
❌ addElement
12. Is .js extension missing?
Node’s require automatically resolves .js →
✔️ no
❌ yes
📊 Summary Table
| Q# | Correct Answer |
|---|---|
| 1 | Blue |
| 2 | 23 |
| 3 | String |
| 4 | Pear |
| 5 | 8 |
| 6 | undefined |
| 7 | 5 |
| 8 | 200 |
| 9 | undefined |
| 10 | event type string |
| 11 | document.createElement(‘h2’) |
| 12 | no |