JavaScript MCQs with answers Page - 25

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

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

Code:
<script>
	document.write(Math.round(107.5))
</script>
  • (A) 107.5
  • (B) 107
  • (C) 108
  • (D) 107.00

A

Admin • 832.27K Points
Coach

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

Code:
<script>
    let x = "10";
    let y = + x;
    
    document.write(typeof y);
</script>
  • (A) string
  • (B) object
  • (C) undefined
  • (D) number

A

Admin • 832.27K Points
Coach

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

Code:
<script>
    let x = 10;
    
    document.write(typeof x, " , ", typeof String(x));
</script>
  • (A) number , string
  • (B) number , number
  • (C) object , string
  • (D) object , object

A

Admin • 832.27K Points
Coach

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

Code:
<script>
    let x = 10;
    
    document.write(x, " , ", toString(x));
</script>
  • (A) 10 , 10
  • (B) 10 , undefined
  • (C) 10 , [object Undefined]
  • (D) None of the above

A

Admin • 832.27K Points
Coach

Q. What is the advantage of the code produced graphics being smaller than the images themselves?

  • (A) Bandwidth saving
  • (B) Increase in bandwidth
  • (C) Dynamic advantages
  • (D) None of the mentioned

A

Admin • 832.27K Points
Coach

Q. Which of the following uses a lot of CPU cycles?

  • (A) GUI
  • (B) Statically generated graphics
  • (C) Dynamically generated graphics
  • (D) All of the mentioned

A

Admin • 832.27K Points
Coach

Q. Consider the code snippet given below
What is the observation made?

Code:
var count = [1,,3];
  • (A) The omitted value takes “undefined”
  • (B) This results in an exception
  • (C) This results in an error
  • (D) None of the mentioned

A

Admin • 832.27K Points
Coach

Q. What is the purpose of image replacement?

  • (A) To replace an image
  • (B) To implement special effects
  • (C) Implementation of image rollovers
  • (D) Removal of image rollovers

A

Admin • 832.27K Points
Coach

Q. Consider the following code snippet . What will be the result?

Code:
var a1 = [,,,]; 
var a2 = new Array(3); 
0 in a1 
0 in a2
  • (A) true false
  • (B) true true
  • (C) false true
  • (D) false true

A

Admin • 832.27K Points
Coach

Q. The pop() method of the array does which of the following task ?

  • (A) decrements the total length by 1
  • (B) increments the total length by 1
  • (C) prints the first element but no effect on the length
  • (D) None

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