Explore topic-wise MCQs in Javascript.

This section includes 145 Mcqs, each offering curated multiple-choice questions to sharpen your Javascript knowledge and support exam preparation. Choose a topic below to get started.

101.

__What is the alternative command used in Node for load()?__

A. store()
B. module()
C. log()
D. require()
Answer» E.
102.

__Which is the root element in a HTML document?__

A. HTML
B. HEAD
C. SCRIPT
D. BODY
Answer» B. HEAD
103.

__Which of the following framework was used by Google for Gmail?__

A. Dojo
B. GWT
C. Closure
D. YUI
Answer» E.
104.

_Which of the following frameworks focuses on DOM and Ajax utilities?$?

A. jQuery
B. Prototype
C. Dojo
D. Both jQueryand Prototype
Answer» E.
105.

_What is the function used to remove all handlers for name events?$?

A. deleteAllListeners(name)
B. deleteListener(name,f)
C. removerListener(name,f)
D. removeAllListeners(name)
Answer» E.
106.

_Which identifier is used to represent a web browser window or frame?$?

A. frames
B. window
C. location
D. frame
Answer» C. location
107.

_When will the window property come into play?$?

A. Representation convenience
B. Use as an extension of other objects
C. Use objects in the Window object
D. Refer to window object itself
Answer» E.
108.

_The style property belongs to while of the following object?$?

A. Element
B. Window
C. Location
D. None of the mentioned
Answer» B. Window
109.

_What is the code snippet to update the content of the timestamp element when the user clicks on it?$?

A. timestamp.onLoad = function() { this.innerHTML = new Date().toString(); }
B. timestamp.onclick = function() { this.innerHTML = new Date().toString(); }
C. timestamp.onload = function() { this.innerHTML = new Date().toString(); }
D. timestamp.onclick = function() { innerHTML = new Date().toString(); }
Answer» C. timestamp.onload = function() { this.innerHTML = new Date().toString(); }
110.

_What will be done if more than one page requires a file of JavaScript code?$?

A. Downloads that many times
B. Retrives from the browser cache
C. Must be re executed
D. None of the mentioned
Answer» C. Must be re executed
111.

What does Rhino do when the getter and setter methods exist?$?

A. It becomes JavaScript properties
B. Java classes are used to avoid them
C. Java classes & JavaScript properties
D. None of the mentioned
Answer» B. Java classes are used to avoid them
112.

Which of the following reads the textual contents of a URL and returns as a string?$?

A. spawn(f);
B. load(filename,…);
C. readFile(file);
D. readUrl(url);
Answer» E.
113.

What is the method used to pause “data” events?$?

A. s.pause();
B. s.stop();
C. s.halt();
D. s.wait();
Answer» B. s.stop();
114.

Client-side JavaScript code is embedded within HTML documents in$?

A. A URL that uses the special javascript:encoding
B. A URL that uses the special javascript:stack
C. A URL that uses the special javascript:protocol
D. A URL that uses the special javascript:code
Answer» D. A URL that uses the special javascript:code
115.

The behaviour of the document elements can be defined by$?

A. Using document object
B. Registering appropriate event handlers
C. Using element object
D. All of the mentioned
Answer» C. Using element object
116.

The necessary globals of a node are defined under which namespace?$?

A. variables
B. system
C. process
D. using
Answer» D. using
117.

What is the command to run the node programs?$?

A. node(program.js)
B. program.js
C. node program.js
D. node.program.js
Answer» D. node.program.js
118.

Which character in JavaScript code will be interpreted as XML markup?$?

A. !
B. >
C. &
D. .
Answer» D. .
119.

Which object is the main entry point to all client-side JavaScript features and APIs?$?

A. Standard
B. Location
C. Window
D. Position
Answer» D. Position
120.

Which of the following is a global object?$?

A. Register
B. Location
C. Window
D. Position
Answer» D. Position
121.

What are the properties supporting CSS styles for a document element?$?

A. style and font
B. style and className
C. size and style
D. className and font
Answer» C. size and style
122.

What is the code snippet to find all container elements with class “reveal”?$?

A. var elements = document.getElementsByClassName("reveal");
B. var elements = document.getElementByClassName("reveal");
C. var elements = document.getElementByName("reveal");
D. var elements = document.getElementsClassName("reveal");
Answer» B. var elements = document.getElementByClassName("reveal");
123.

One of the main advantage of using src attribute is$?

A. It becomes self-cached
B. It makes the HTML file modular
C. It restricts manipulation in the HTML file
D. It simplifies the HTML files
Answer» E.
124.

Which of the following is not a framework?$?

A. jQuery
B. .NET
C. JavaScript
D. None of the mentioned
Answer» D. None of the mentioned
125.

What is the function used to deregister event handler ‘f’?$?

A. deleteAllListeners(name)
B. deleteListener(name,f)
C. removerListener(name,f)
D. removeAllListeners(name)
Answer» D. removeAllListeners(name)
126.

What are the two incompatible versions of YUI?$?

A. YUI1 and YUI2
B. YUI2 and YUI4
C. YUI1 and YUI3
D. YUI2 and YUI3
Answer» B. YUI2 and YUI4
127.

Which of the following is not a framework??

A. jQuery
B. .NET
C. JavaScript
D. None of the mentioned
Answer» D. None of the mentioned
128.

What is the function used to deregister event handler ‘f’??

A. deleteAllListeners(name)
B. deleteListener(name,f)
C. removerListener(name,f)
D. removeAllListeners(name)
Answer» D. removeAllListeners(name)
129.

Which object is the main entry point to all client-side JavaScript features and APIs??

A. Standard
B. Location
C. Window
D. Position
Answer» D. Position
130.

Which of the following is a global object??

A. Register
B. Location
C. Window
D. Position
Answer» D. Position
131.

What are the properties supporting CSS styles for a document element??

A. style and font
B. style and className
C. size and style
D. className and font
Answer» C. size and style
132.

What is the code snippet to find all container elements with class “reveal”??

A. var elements = document.getElementsByClassName("reveal");
B. var elements = document.getElementByClassName("reveal");
C. var elements = document.getElementByName("reveal");
D. var elements = document.getElementsClassName("reveal");
Answer» B. var elements = document.getElementByClassName("reveal");
133.

One of the main advantage of using src attribute is?

A. It becomes self-cached
B. It makes the HTML file modular
C. It restricts manipulation in the HTML file
D. It simplifies the HTML files
Answer» E.
134.

Consider the following code snippetvar f = new java.io.File("/tmp/test");var out = new java.io.FileWriter(f);out instanceof java.io.ReaderWhat will be the output for the above code snippet?

A. Error
B. True
C. Exception
D. False
Answer» E.
135.

JavaScript code between a pair of “script” tags are called$

A. Non-inline
B. External
C. Referenced
D. Inline
Answer» E.
136.

A JavaScript program can traverse and manipulate document content through

A. Element Object
B. Document Object
C. Both Element and Document Object
D. None of the mentioned
Answer» D. None of the mentioned
137.

The libraries that build a new higher-level API for client-side programming is

A. Library
B. Framework
C. APIs
D. All of the mentioned
Answer» C. APIs
138.

The word “document” mainly refers to$

A. Dynamic Information
B. Static Information
C. Both Dynamic and Static Information
D. None of the mentioned
Answer» C. Both Dynamic and Static Information
139.

The setTimeout() method is used to

A. Make the event sleep
B. Register a function to be invoked after a certain time
C. Invoke an event after a certain time
D. Time for iteration
Answer» C. Invoke an event after a certain time
140.

What is the property to access the first child of a node?

A. timestamp.Child1
B. timestamp.Child(1)
C. timestamp.Child(0)
D. timestamp.firstChild
Answer» E.
141.

When a program contains extensive use of event handlers, which of the following is necessary?

A. Modular functions
B. Nested functions
C. Split up programs
D. All of the mentioned
Answer» C. Split up programs
142.

What is the code to start displaying the time when document loads?

A. onload = displayTime;
B. window. = displayTime;
C. window.onload = displayTime;
D. window.onload = start;
Answer» D. window.onload = start;
143.

Rhino is originated by

A. Microsoft
B. Mozilla
C. Apple
D. None of the mentioned
Answer» C. Apple
144.

The main purpose of JavaScript in web browser is to

A. Creating animations and other visual effects
B. User Interface
C. Visual effects
D. None of the mentioned
Answer» B. User Interface
145.

What is the code to print hello one second from now?

A. setTimeout(function() { console.log("Hello World"); }, 1000);
B. setTimeout(function() { 1000, console.log("Hello World"); });
C. setTimeout(function(1000) { console.log("Hello World"); });
D. setTimeout(function() { console.log("Hello World"); });
Answer» B. setTimeout(function() { 1000, console.log("Hello World"); });