Explore topic-wise MCQs in Javascript.

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

1.

How to lazy load images?

A. emove the rel attribute
B. emove the src attribute
C. ake rel = src
D. ake src = rel
Answer» C. ake rel = src
2.

What should be the value of the type attribute of a variable if the type of file is CSS?

A. ext/js/css
B. ext/js
C. ext/css
D. ext
Answer» D. ext
3.

What does the appendChild() method perform?

A. ppends a node in the middle of the index taken as the parameter
B. ppends a node as the first child
C. ppends a node as the last child
D. one of the mentioned
Answer» D. one of the mentioned
4.

Which of the following API can be used to get the timing without affecting the page loading process?

A. avigation API
B. iming API
C. avigation Timing API
D. one of the mentioned
Answer» D. one of the mentioned
5.

Why do we need to use an onload event in the script tag after using the async attribute?

A. nvoke code during page loading
B. nvoke code during script loading
C. nvoke code during downloading
D. one of the mentioned
Answer» D. one of the mentioned
6.

What will happen if the browser encounters a script tag without an src attribute?

A. hrows an error
B. hrows an exception
C. ends it to the compiler
D. ends it to the interpreter
Answer» E.
7.

Which of the below does not belong to the Render Engine work flow?

A. aint DOM elements
B. arse Content
C. ild DOM nodes in render tree
D. one of the mentioned
Answer» E.
8.

What is the purpose of the method localeCompare()?

A. If the reference string comes before or after another string
B. If the reference string is validated
C. If the string is a reference string
D. None of the mentioned
Answer» B. If the reference string is validated
9.

When the 'end' event fires on EOF when no more data will arrive, which function is called?

A. s.on("data",f);
B. s.on("end",f);
C. s.on("error",f);
D. s.on("default",f);
Answer» C. s.on("error",f);
10.

What is the type of datatype the async attribute optionally accepts?

A. Integer
B. String
C. Boolean
D. Decimal
Answer» D. Decimal
11.

What does the rel attribute of a variable have when the type of file is CSS?

A. css
B. stylesheet
C. text/css
D. all of the mentioned
Answer» C. text/css
12.

What is the purpose of the startTimeLogging() method?

A. Start the timer
B. Capture time logging
C. Capture timing data for referencing
D. All of the mentioned
Answer» E.
13.

What is the method used to create an element in the HTML DOM?

A. createDOMelement()
B. createElement()
C. createDOMElement()
D. none of the mentioned
Answer» C. createDOMElement()
14.

What will happen after executing the script?

A. Execute script
B. Layout positioning of DOM elements
C. Paint DOM elements
D. Build DOM nodes in render tree
Answer» E.
15.

How many constant values can the property type be represented?

A. 2
B. 3
C. 4
D. 5
Answer» D. 5
16.

How can one access the redirectCount property?

A. navigation.redirectCount
B. performance.navigation.redirectCount
C. performance.redirectCount
D. redirectCount
Answer» C. performance.redirectCount
17.

Where does the DNS Lookup direct to ?

A. Browser
B. Client
C. Server
D. DNS Server
Answer» E.
18.

How do we stop blocking of loading and executing the perfLogger, a logging type data?

A. Inlining the perfLogger
B. Removing the perfLogger
C. Placing the perfLogger before the 'script' tag
D. None of the mentioned
Answer» B. Removing the perfLogger
19.

What is the parameter of the method getElementsbyTagName() if we need to get an image?

A. image
B. src
C. img
D. imageurl
Answer» D. imageurl
20.

What would happen if there were no script tags?

A. Build DOM nodes in render tree
B. Layout positioning of DOM elements
C. Paint DOM elements
D. Execute script
Answer» B. Layout positioning of DOM elements
21.

What is the result when the showPerformanceMetrics() is called before loading the remote script?

A. Throws an exception
B. Throws an error
C. It will load by itself
D. None of the mentioned
Answer» C. It will load by itself
22.

What does the constant TYPE_BACK_FORWRD indicate?

A. Navigation via browser history
B. Navigation via user request
C. Navigation via URL
D. None of the mentioned
Answer» B. Navigation via user request
23.

How many properties are there in window.performance object?

A. 1
B. 4
C. 2
D. 3
Answer» D. 3
24.

How many properties are there in the interface PerformanceTiming?

A. 21
B. 22
C. 23
D. 24
Answer» B. 22
25.

What is the purpose of the property PerformanceTiming.fetchStart?

A. Browser ready to fetch input
B. Browser ready to fetch document
C. Browser ready to fetch summary
D. All of the mentioned
Answer» C. Browser ready to fetch summary
26.

Which of the following property is associated with the Request event?

A. requestStart
B. requestEnd
C. both requestStart and requestEnd
D. none of the mentioned
Answer» B. requestEnd
27.

What is the purpose of garbage collection?

A. Removes object with many reference
B. Removes object with reference
C. Removes object with invalid reference
D. Removes object with no reference
Answer» E.
28.

What is the function of the memory object?

A. Gets unused memory details
B. Shows optimization
C. Gets memory usage
D. None of the mentioned
Answer» D. None of the mentioned
29.

Which of the following gives the high level breakdown of memory usage?

A. about:memory
B. memory
C. about-memory
D. about::memory
Answer» B. memory
30.

Which keyword must be used to get a more granular insight of the memory usage?

A. verb
B. verbose
C. granule
D. none of the mentioned
Answer» C. granule
31.

Which of the following is an interface?

A. Time
B. Timing
C. Performance
D. PerformanceTiming
Answer» E.
32.

Which of the following is a read-only property?

A. PerformanceTiming.navigationStart
B. PerformanceTiming.fetchStart
C. PerformanceTiming.navigationStart & PerformanceTiming.fetchStart
D. None of the mentioned
Answer» D. None of the mentioned
33.

How many properties are associated with the Response event?

A. 1
B. 2
C. 3
D. 4
Answer» C. 3
34.

Which of the following property is associated with the Processing event?

A. domComplete
B. domContentLoaded
C. domInteractive
D. none of the mentioned
Answer» E.
35.

Which of the following property is associated with the Response event?

A. responseStart
B. responseEnd
C. both responseStart and responseEnd
D. none of the mentioned
Answer» D. none of the mentioned
36.

How do we stop blocking of loading and executing the perfLogger, a logging type data?%!

A. Inlining the perfLogger
B. Removing the perfLogger
C. Placing the perfLogger before the “script” tag
D. None of the mentione
Answer» B. Removing the perfLogger
37.

What is the parameter of the method getElementsbyTagName() if we need to get an image?%!

A. image
B. src
C. img
D. imageurl
Answer» D. imageurl
38.

What does the rel attribute of a variable have when the type of file is CSS?%!

A. css
B. stylesheet
C. text/css
D. all of the mentioned
Answer» C. text/css
39.

What should be the type of the script_url?%!

A. Object
B. String
C. Array
D. Any of the mentioned
Answer» E.
40.

What would happen if there were no script tags?%!

A. Build DOM nodes in render tree
B. Layout positioning of DOM elements
C. Paint DOM elements
D. Execute script
Answer» B. Layout positioning of DOM elements
41.

Which of the following navigator object properties is the same in both Netscape and IE?%!

A. navigator.appCodeName
B. navigator.appName
C. navigator.appVersion
D. none of the mentioned
Answer» B. navigator.appName
42.

To define each of the set classes as a property of the sets object (namespace) for the module, the statement is%!

A. sets = sets.AbstractEnumerableSet.extend();
B. sets.SingletonSet = sets.AbstractEnumerableSet.extend(...);
C. sets.SingletonSet = sets.extend(...);
D. sets = sets.extend(...);
Answer» C. sets.SingletonSet = sets.extend(...);
43.

What is the method used to create an element in the HTML DOM?%!

A. createDOMelement()
B. createElement()
C. createDOMElement()
D. none of the mentioned
Answer» C. createDOMElement()
44.

Which of the following layer retrieves the content from the network?%!

A. Transport Layer
B. Application Layer
C. Network Layer
D. Physical Layer
Answer» D. Physical Layer
45.

How many constant values can the property type be represented?%!

A. 2
B. 3
C. 4
D. 5
Answer» D. 5
46.

Where does the DNS Lookup direct to ?%!

A. Browser
B. Client
C. Server
D. DNS Server
Answer» E.
47.

What is the purpose of garbage collection?%!

A. Removes object with many reference
B. Removes object with reference
C. Removes object with invalid reference
D. Removes object with no reference
Answer» E.
48.

Which keyword must be used to get a more granular insight of the memory usage?%!

A. verb
B. verbose
C. granule
D. none of the mentioned
Answer» C. granule
49.

How many properties are associated with the Response event?%!

A. 1
B. 2
C. 3
D. 4
Answer» C. 3
50.

What is the purpose of the navigation property in the window.performance object?%!

A. To which page the user navigated
B. How the user navigated
C. All of the mentioned
D. None of the mentioned
Answer» C. All of the mentioned