JavaScript MCQs with answers Page - 140

Here, you will find a collection of MCQ questions on JavaScript. Go through these questions to enhance your preparation for upcoming examinations and interviews.

To check the correct answer, simply click the View Answer button provided for each question.

Have your own questions to contribute? Click the button below to share your MCQs with others!

+ Add Question

A

Admin • 833K Points
Coach

Q. What will be the result of await Promise.reject('error') in async function?

  • (A) Unhandled rejection error
  • (B) Syntax error
  • (C) Code continues
  • (D) undefined

A

Admin • 833K Points
Coach

Q. Which of the following is NOT a valid JavaScript class feature?

  • (A) private class variables using #
  • (B) static methods
  • (C) public class properties
  • (D) constructors overloading

A

Admin • 833K Points
Coach

Q. Which object method executes a reducer function on each element?

  • (A) reduce()
  • (B) map()
  • (C) filter()
  • (D) sort()

A

Admin • 833K Points
Coach

Q. What will console.log(typeof []) return?

  • (A) object
  • (B) array
  • (C) list
  • (D) function

A

Admin • 833K Points
Coach

Q. What is the result of 2 + '2'?

  • (A) 22
  • (B) 4
  • (C) undefined
  • (D) NaN

A

Admin • 833K Points
Coach

Q. Which feature allows defining class-level methods?

  • (A) static
  • (B) global
  • (C) const
  • (D) private

A

Admin • 833K Points
Coach

Q. How do you catch both resolved and rejected states of a Promise?

  • (A) then().catch()
  • (B) catch().then()
  • (C) done().fail()
  • (D) async()

A

Admin • 833K Points
Coach

Q. Which method ensures code runs regardless of Promise result?

  • (A) finally()
  • (B) always()
  • (C) resolve()
  • (D) done()

A

Admin • 833K Points
Coach

Q. What is the event loop in JavaScript?

  • (A) A mechanism that handles asynchronous callbacks
  • (B) A loop used to iterate over DOM elements
  • (C) A function that repeats code
  • (D) A type of loop like for or while

A

Admin • 833K Points
Coach

Q. Which queue does setTimeout use?

  • (A) macrotask queue
  • (B) microtask queue
  • (C) callback queue
  • (D) event queue

Add MCQ in this Category

If you want to share an MCQ question in this category, it's a great idea! It will be helpful for many other students using this website.

Share Your MCQ