JavaScript MCQs with answers Page - 55

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. Which method of the iterable object returns an iterator object for the collection?

  • (A) iterator()
  • (B) _iteration_()
  • (C) _iterator_()
  • (D) _return_iterator_()

A

Admin • 833K Points
Coach

Q. Consider the following code snippet

Code:
let succ = function(x) x+1, yes = function() true, no = function() false;
  • (A) Functional behaviour
  • (B) Modular behaviour
  • (C) No convenience
  • (D) Shorthand expression

A

Admin • 833K Points
Coach

Q. Consider the following code snippet

Code:
data.sort(function(a,b),b-a);
  • (A) Sort in the alphabetical order
  • (B) Sort in the chronological order
  • (C) Sort in reverse alphabetical order
  • (D) Sort in reverse numerical order

A

Admin • 833K Points
Coach

Q. Which is the correct code that returns a complex number that is the complex conjugate of this one?

  • (A) Complex.prototype.conj = function() { return new Complex(this.r, -this.i); };
  • (B) Complex.prototype.conj = function() { return Complex(this.r, -this.i); };
  • (C) Complex.prototype.conj = function() { return (this.r, -this.i); };
  • (D) Complex.prototype.conj = function() { new Complex(this.r, -this.i); };

A

Admin • 833K Points
Coach

Q. How can we make methods available on all objects?

  • (A) Object.add(methods)
  • (B) Object.methods(add)
  • (C) Object.add.methods(…)
  • (D) Object.prototype

A

Admin • 833K Points
Coach

Q. What is the procedure to add methods to HTMLElement so that they will be inherited by the objects that represent the HTML tags in the current document?

  • (A) HTMLElement.prototype
  • (B) HTMLElement.prototype(…)
  • (C) HTML.elements(add)
  • (D) HTML.addmethods()

A

Admin • 833K Points
Coach

Q. You can refresh the webpage in JavaScript by using

  • (A) window.reload
  • (B) location.reload
  • (C) window.refresh
  • (D) page.refresh

A

Admin • 833K Points
Coach

Q. The functions provide() and require() of Dojo toolkit and Google’s Closure library are used for

  • (A) declaring and loading modules
  • (B) loading and declaring modules
  • (C) declaring modules
  • (D) none of these

A

Admin • 833K Points
Coach

Q. What is the object that is in TOP of the root in JavaScript?

  • (A) url
  • (B) top
  • (C) window
  • (D) document

A

Admin • 833K Points
Coach

Q. How to insert a comment on several lines?

  • (A) //This comment has more than one line //
  • (B) /* This comment has more than one line */
  • (C) Any of them
  • (D) Both of them

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