Explore topic-wise MCQs in Javascript.

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

1.

Which property lays the element according to the normal flow?

A. relative
B. absolute
C. fixed
D. static
Answer» B. absolute
2.

The inner frame within a top-level window can be referred to as _____________

A. parent(parent)
B. parent.parent
C. parent*parent
D. parent/parent
Answer» C. parent*parent
3.

Which is the method that operates on the return value of $()?

A. show()
B. css()
C. click()
D. done()
Answer» C. click()
4.

Which of the following is a heavily overloaded function?

A. jQuery()
B. $()
C. script()
D. Both jQuery() and $()
Answer» E.
5.

What is the purpose of the method getUserData(key)?

A. Returns the associated object
B. Gets the user data
C. Returns the user data
D. Gets the user key
Answer» B. Gets the user data
6.

Which method receives the return value of setInterval() to cancel future invocations?

A. clearInvocation()
B. cancelInvocation()
C. clearInterval()
D. clear()
Answer» D. clear()
7.

Which of the following is the default positioning elements with CSS?

A. relative
B. static
C. absolute
D. none of the mentioned
Answer» C. absolute
8.

How many nodetype – named constants are available?

A. 13
B. 11
C. 12
D. 10
Answer» D. 10
9.

Which method is used to compare the placement of two nodes in the DOM hierarchy (document)?

A. compareDocumentPosition()
B. cloneNode()
C. getUserData()
D. getFeature()
Answer» B. cloneNode()
10.

Which of the following is the Web application equivalent to querySelectorAll()?

A. #()
B. &()
C. $()
D. None of the mentioned
Answer» D. None of the mentioned
11.

Which of the below is a liberal reverse of Ajax?

A. HTTP
B. HTML
C. XML
D. Comet
Answer» E.
12.

Which of the following Node types have a node value equal to null?

A. Document
B. DocumentFragment
C. DocumentType
D. All of the mentioned
Answer» E.
13.

Which of the following is the child(s) of the node type EntityReference?

A. Element
B. Text
C. Both Element and Text
D. Entity
Answer» D. Entity
14.

How can you set a Cookie visibility scope to localStorage?

A. /
B. %
C. *
D. //
Answer» B. %
15.

How many node object properties are there?

A. 12
B. 14
C. 16
D. 17
Answer» D. 17
16.

The return type of getElementsByClassName() is __________

A. DOM
B. Document
C. Node
D. NodeList
Answer» E.
17.

What is the purpose of the method item()?

A. Returns node after the specified index
B. Returns node before the specified index
C. Returns node at specified index
D. Returns the node following the specified node
Answer» D. Returns the node following the specified node
18.

The paragraph “p” is a part of __________

A. h1
B. body
C. html
D. Both body and html
Answer» E.
19.

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

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

What is the programming philosophy that argues that content and behaviour should as much as possible be kept separate?

A. Unobtrusive JavaScript
B. Obtrusive JavaScript
C. Inherited JavaScript
D. Modular JavaScript
Answer» B. Obtrusive JavaScript
21.

Which property holds a DataTransfer object that contains information about the data being transferred and the formats in which it is available?

A. dataTransfer
B. transferData
C. dataExchange
D. exchangeData
Answer» B. transferData
22.

The high-level events among the following events are ____________

A. User interface events
B. Device-independent events
C. Device-dependent events
D. Stage event change
Answer» B. Device-independent events
23.

What is the property textContent?

A. Sets the textual content of a node
B. Returns the textual content of a node
C. Sets & Returns the textual content of a node
D. Modifies texual content
Answer» D. Modifies texual content
24.

For what value does the keyCode property persists even when a Shift key is pressed for adding punctuation character.

A. Special characters
B. Alphabets
C. Alphanumeric
D. Digits
Answer» E.
25.

What is the purpose of the DocumentFragment node type?

A. To hold a portion of a document
B. To split the document into fragments
C. To hold the entire document
D. To hold the fragments
Answer» B. To split the document into fragments
26.

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
27.

To which object does the location property belong?

A. Window
B. Position
C. Element
D. Location
Answer» B. Position
28.

Why is the replace() method better than the assign() method?

A. Reliable
B. Highly manageable
C. More efficient
D. Handles unconditional loading
Answer» E.
29.

What does the nodeName of the nodeType Document return?

A. doctype name
B. target
C. #comment
D. #document
Answer» E.
30.

Which of the following is used for parsing JSON text?

A. jQuery.each()
B. jQuery.parseJSON()
C. jQuery.noConflict()
D. jQuery.conflict()
Answer» C. jQuery.noConflict()
31.

How are windows, tabs, iframes, and frames treated according to javascript?

A. They are all browsing contexts
B. They are all browsing informations
C. They are all Window contexts
D. They are all Window objects
Answer» E.
32.

What is the function used to extract arguments from the search property of a URL?

A. urlArgs()
B. url()
C. hash()
D. geturl()
Answer» B. url()
33.

What is the purpose of the assign() method?

A. Only loading
B. Loading of window and display
C. Displays already present window
D. Unloading of window
Answer» C. Displays already present window
34.

Which of the following can be used to select HTML elements based on the value of their name attributes?

A. getElementByName()
B. getElementsByName()
C. getElementsName()
D. getElementName()
Answer» C. getElementsName()
35.

Which of the following communicates with server-side CGI scripts through HTML form submissions and can be written without the use of JavaScript?

A. Static Web Pages
B. Interactive Web Pages
C. Conditional Web Pages
D. All web pages
Answer» C. Conditional Web Pages
36.

Which of the following is an equivalent replacement of $(document).ready(f)?

A. jQuery(f)
B. $(f)
C. #(f)
D. read(f)
Answer» C. #(f)
37.

Each tab in the single web browser window is called as ____________

A. Browser Information
B. Browsing context
C. Both Browser Information & Browsing context
D. Browser Log
Answer» C. Both Browser Information & Browsing context
38.

The events that are directly tied to a specific input device are ____________

A. Device-independent input events
B. Device-dependent input events
C. User interface events
D. State change events
Answer» C. User interface events
39.

Which of the following property allows you to specify an element's position with respect to the browser window?

A. relative
B. fixed
C. static
D. absolute
Answer» C. static
40.

The events that are not directly tied to a specific input device are _____________

A. User interface events
B. Device-independent events
C. Device-dependent events
D. Stage event change
Answer» C. Device-dependent events
41.

The Text and Comment is part of __________

A. CharacterData
B. Document
C. Attr
D. Element
Answer» B. Document
42.

What is the return type of the hash property?

A. Query string
B. Packets
C. String
D. Fragment identifier
Answer» E.
43.

How to associate an object to a key on a node?

A. getUserData()
B. cloneNode()
C. setUserData(key,data,handler)
D. clonedata()
Answer» D. clonedata()
44.

The history property belongs to which object?

A. Element
B. Window
C. History
D. Location
Answer» D. Location
45.

Which of the following is a utility function in jQuery?

A. jQuery.each()
B. jQuery.parseJSON()
C. jQuery.noConflict()
D. jQuery.conflict()
Answer» D. jQuery.conflict()
46.

Which method is an alternative of the property location of a window object?

A. submit()
B. locate()
C. load()
D. write()
Answer» B. locate()
47.

What does the location property represent?

A. Current DOM object
B. Current URL
C. Both DOM object and URL
D. Document
Answer» C. Both DOM object and URL
48.

When will the fourth argument to open() useful?

A. When the second argument names a retired window
B. When the first argument names an existing window
C. When the second argument names an existing window
D. When the first argument names a retired window
Answer» D. When the first argument names a retired window
49.

Which method receives the return value of setTimeout() to cancel future invocations?

A. clearTimeout()
B. clearInterval()
C. clearSchedule()
D. cancelInvocation()
Answer» B. clearInterval()
50.

What will happen if we call setTimeout() with a time of 0 ms?

A. Placed in stack
B. Placed in queue
C. Will run continuously
D. Will execute immediately
Answer» C. Will run continuously