Programming
Finals Assessment Review
(Questions & Solutions)
2025
©2025
,Multiple Choice (MCQ)
1. Which of the following statements about JavaScript’s event loop is
correct?
A) The event loop executes synchronous code only.
B) The event loop continuously checks the call stack and task queue.
C) Promises are resolved immediately after they are created.
D) setTimeout always executes exactly after the specified time.
ANS: B
Rationale: The event loop monitors the call stack and the task queue,
processing items accordingly.
2. What is the result of the following code?
let obj = { a: 1 };
Object.freeze(obj);
obj.a = 2;
console.log(obj.a);
A) 1
B) 2
C) undefined
D) Error
ANS: A
Rationale: Object.freeze prevents changes to properties, so obj.a remains
1.
3. Which method creates a shallow copy of an object in JavaScript?
A) Object.freeze()
B) Object.assign()
C) Object.create()
D) Object.defineProperty()
©2025
, ANS: B
Rationale: Object.assign({}, obj) produces a shallow copy.
4. What will the following code log to the console?
let foo = async () => {
return 1;
};
foo().then(console.log);
A) undefined
B) Promise
C) 1
D) Error
ANS: C
Rationale: async functions return promises that resolve to their return
value, logging 1.
5. In JavaScript, which of the following is NOT a valid way to declare a
class property?
A) Using getter and setter methods
B) Using constructor assignment
C) Declaring properties directly outside the constructor
D) Using the "static" keyword for instance properties
ANS: D
Rationale: "static" is for static properties, not instance properties.
6. Which of the following about closures is TRUE?
A) Closures cannot access variables outside their local scope.
B) Closures allow inner functions to access outer function variables even
after the outer function has returned.
C) Closures are only created with arrow functions.
D) Closures are unique to JavaScript.
©2025