Final graded quiz: Programming with JavaScript :Programming with JavaScript (Meta React Native Specialization) Answers 2025
1. Output?
✔️ Green
❌ Blue
❌ Nothing
(Because b == 5 makes the OR condition true.)
2. Output?
x = 2
x += 5 → x = 7
✔️ 7
❌ 2
❌ 3
❌ 5
3. Data type of x?
var x = 0 != 1; // true
✔️ Boolean
❌ Number
❌ BigInt
❌ String
4. Output?
✔️ Apple
❌ Pear
❌ Orange
(20 ≥ 10)
5. Output?
result = 0
Loop runs 5 times, each time +2 → total = 10
✔️ 10
❌ 0
❌ 2
❌ 5
6. Output?
✔️ Circle
❌ Square
(The throw stops execution and goes to catch.)
7. Output?
5 + "10" = "510"
✔️ 510
❌ 5
❌ 10
8. Output?
✔️ 200
❌ 100
❌ 300
(Accessing object property)
9. Output?
veggies[2] → does not exist
✔️ undefined
❌ 2
❌ 1
❌ 3
10. HTML attribute for click event?
✔️ onclick
❌ addEventListener(‘click’)
❌ ‘click’
11. Create an h2 element?
✔️ document.createElement(‘h2’)
❌ document.buildElement(‘h2’)
❌ document.addElement(‘h2’)
12. Missing .js extension?
✔️ yes
❌ no
(Node requires extension unless resolved by module system.)
✅ Summary Table
| Q.No | Correct Answer | Explanation |
|---|---|---|
| 1 | Green ✔️ | OR condition true because b == 5. |
| 2 | 7 ✔️ | 2 + 5 = 7. |
| 3 | Boolean ✔️ | != returns true. |
| 4 | Apple ✔️ | 20 ≥ 10. |
| 5 | 10 ✔️ | Loop adds 2 five times. |
| 6 | Circle ✔️ | Error thrown → catch block. |
| 7 | 510 ✔️ | Number + string = string. |
| 8 | 200 ✔️ | car.mileage = 200. |
| 9 | undefined ✔️ | Index 2 doesn’t exist. |
| 10 | onclick ✔️ | HTML attribute for click. |
| 11 | createElement ✔️ | Correct DOM method. |
| 12 | yes ✔️ | Require usually needs .js. |