JavaScript MCQ Questions and Answers

21. What are the types of Pop up boxes available in JavaScript?

  1. Confirm
  2. Alert
  3. Prompt
  4. All of the above

Answer : D
Explanation: JavaScript offers different types of pop up boxes including confirm, alert and prompt.

22. The property of the JSON( ) method is:

  1. it will be automatically invoked by the compiler
  2. it is invoked automatically by the JSON.stringify() method
  3. it can be invoked manually as object.JSON()
  4. it cannot be invoked in any form

Answer : B
Explanation: The JSON format is intended for the serialization of data structures and can handle JavaScript primitive values, arrays, and plain objects. It does not know about classes, and when serializing an object, it ignores the object’s prototype and constructor. If you call JSON.stringify() on a Range or Complex object, for example, it returns a string like {“from”:1, “to”:3} or {“r”:1, “i”:-1}, so option B is correct.

23.  Spaces, Punctuation marks are called as ________ Symbols in JavaScript.

  1. Special
  2. Punctual
  3. Mandatory
  4. None of the above

Answer : A
Explanation: Spaces, punctuation marks are called as special symbols in JavaScript.

24. Which of the following is not considered a JavaScript operator?

  1. this
  2. new
  3. typeof
  4. delete

Answer : A
Explanation: None.

25. What is the use of < noscript > tag?

  1. Prevents scripts on the page from executing
  2. Enclose text to be displayed by non-JavaScript browsers
  3. Stops cookies
  4. None of the mentioned

Answer : B
Explanation: < noscript > tag enclose text to be displayed by non-JavaScript browsers.

26. Which of the following are the errors in JavaScript?

  1. Load time errors
  2. Logical Errors
  3. Run time errors
  4. All of the above

Answer : D
Explanation: Load time errors: Load-time errors are perhaps the most common and are generally caused by problems in syntax.
Run time errors: A runtime error is a program error that occurs while the program is running.
Logical Errors: A logic error (or logical error) is a mistake in a program’s source code that results in incorrect or unexpected behavior. So option D is correct.

27. Local Browser used for validations on the Web Pages uses 

  1. HTML
  2. CSS
  3. JS
  4. Java

Answer : C
Explanation: Local Browser used for validations on the Web Pages uses JS.

28. Comments in JS are ignored by ______

  1. Browser
  2. JVM
  3. Operating System
  4. Compiler

Answer : A
Explanation: Comments in JS are ignored by the browser.

29. Which of the following is not JavaScript Data Types?

  1. Float
  2. Undefined
  3. Boolean
  4. Number

Answer : A
Explanation: Float is not a JavaScript data type. Different JavaScript Data types are Number, String, Boolean, Object, Undefined. So option A is correct.

30. Javascript is interpreted by

  1. Server
  2. Client
  3. Object
  4. None of the mentioned

Answer : B
Explanation: Javascript is interpreted by the Client. JavaScript is an interpreted language, not a compiled language. A program such as C++ or Java needs to be compiled before it runs. The source code is passed through a program called a compiler, which translates it into bytecode that the machine understands and can execute, So option B is correct.

This Post Has 3 Comments

Leave a Reply