JavaScript MCQs with answers Page - 67

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. Consider the following code snippet :
var grand_Total=eval("10*10+5");
The output for the above statement would be :

  • (A) 10*10+5
  • (B) 105 as a string
  • (C) 105 as an integer value
  • (D) Exception is thrown

A

Admin • 833K Points
Coach

Q. Consider the code snippet given below
var count = [1,,3];
What is the observation made?

  • (A) The omitted value takes “undefined”
  • (B) This results in an error
  • (C) This results in an exception
  • (D) None of the mentioned

A

Admin • 833K Points
Coach

Q. Consider the following code snippet
var a1 = [,,,];
var a2 = new Array(3);
0 in a1
0 in a2
The result would be

  • (A) true false
  • (B) false true
  • (C) true true
  • (D) false true

A

Admin • 833K 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 of the mentioned

A

Admin • 833K Points
Coach

Q. Consider the following code snippet :
if (!a[i]) continue ;
What is the observation made ?

  • (A) Skips the undefined elements
  • (B) Skips the non existent elements
  • (C) Skips the null elements
  • (D) All of the mentioned

A

Admin • 833K Points
Coach

Q. What will happen if reverse() and join() methods are used simultaneously ?

  • (A) Reverses and stores in the same array
  • (B) Reverses and concatenates the elements of the array
  • (C) Reverses
  • (D) All of the mentioned

A

Admin • 833K Points
Coach

Q. Consider the following code snippet :
var a = [1,2,3,4,5];
a.slice(0,3);
What is the possible output for the above code snippet ?

  • (A) Returns [1,2,3]
  • (B) Returns [4,5]
  • (C) Returns [1,2,3,4]
  • (D) Returns [1,2,3,4,5]

A

Admin • 833K Points
Coach

Q. Consider the following code snippet :
var a = [];
a.unshift(1);
a.unshift(22);
a.shift();
a.unshift(3,[4,5]);
a.shift();
a.shift();
a.shift();
The final output for the shift() is

  • (A) 1
  • (B) [4,5]
  • (C) [3,4,5]
  • (D) Exception is thrown

A

Admin • 833K Points
Coach

Q. The primary purpose of the array map() function is that it

  • (A) maps the elements of another array into itself
  • (B) passes each element of the array and returns the necessary mapped elements
  • (C) passes each element of the array on which it is invoked to the function you specify, and returns an array containing the values returned by that function
  • (D) None of the mentioned

A

Admin • 833K Points
Coach

Q. The reduce and reduceRight methods follow a common operation called

  • (A) filter and fold
  • (B) inject and fold
  • (C) finger and fold
  • (D) fold

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