JavaScript MCQs with answers Page - 153

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 • 831.35K Points
Coach

Q. What is the default scope of variables declared with var?

  • (A) Block
  • (B) Function
  • (C) Global
  • (D) Module

A

Admin • 831.35K Points
Coach

Q. Which keyword prevents object modification?

  • (A) const
  • (B) Object.seal()
  • (C) Object.freeze()
  • (D) Object.prevent()

A

Admin • 831.35K Points
Coach

Q. What is the result?

Code:
let a = [1,2,3];
a.length = 0;
console.log(a);
  • (A) []
  • (B) [1,2,3]
  • (C) undefined
  • (D) null

A

Admin • 831.35K Points
Coach

Q. Which keyword is used to handle errors?

  • (A) handle
  • (B) try
  • (C) check
  • (D) error

A

Admin • 831.35K Points
Coach

Q. What is the output?

Code:
let x = [1,2,3];
console.log(x instanceof Array);
  • (A) true
  • (B) false
  • (C) undefined
  • (D) SyntaxError

A

Admin • 831.35K Points
Coach

Q. What does the spread operator (...) do?

  • (A) Deletes properties
  • (B) Merges arrays or objects
  • (C) Freezes variables
  • (D) Compiles code

A

Admin • 831.35K Points
Coach

Q. What will this output?

Code:
let name = 'John';
console.log(`Hello ${name}`);
  • (A) Hello ${name}
  • (B) Hello name
  • (C) Hello John
  • (D) undefined

A

Admin • 831.35K Points
Coach

Q. Which object method is used to get object keys?

  • (A) Object.getKeys()
  • (B) Object.keys()
  • (C) Object.values()
  • (D) Object.entries()

A

Admin • 831.35K Points
Coach

Q. What will be the output of the following code?

Code:
console.log(typeof null);
  • (A) object
  • (B) null
  • (C) undefined
  • (D) number

A

Admin • 831.35K Points
Coach

Q. What does the following expression evaluate to?

Code:
console.log(1 + '2' + 3);
  • (A) 6
  • (B) 123
  • (C) 33
  • (D) 15

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