1. What is the purpose of lazy loading?
a) Immediate loading is necessary
b) Loading under command
c) Immediate loading is not necessary
d) Loading after a definite interval
a) After window.onload event
b) Before window.onload event
c) In the header tag
d) In the HTML tag
3. What are the parameters of the attachEvent function?
b) Function, Event
c) Event, Function
Explanation: The addEventListener() method attaches an event handler to an element without overwriting existing event handlers. The attachEvent function accepts two parameters: the event to attach to, and the function to invoke when the event occurs.
4. 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) Throws an exception and It will load by itself
Explanation: perflogger.showPerformanceMetrics() tells the user about the performance parameters of the script loading. If you try to make the call to perfLogger.showPerformanceMetrics() and the script hasn’t just loaded but also executed, then you will get an error.
5. Which of the following is an attribute to the script object?
Explanation: The onload event occurs when an object has been loaded. The onload event occurs when an object has been loaded.
6. Which is the method used to add an event listener?
Explanation: The addEventListener() method attaches an event handler to the specified element. The addEventListener() method is used to add an event listener to the script.
7. What is the purpose of the domLoading attribute?
a) Document exists
b) Document can load
c) Document has loaded
d) Document begins to load
Explanation: domLoading is the time immediately before the user agent sets the current document readiness to ‘loading’. The domLoading attribute is used when the document begins to load.
8. How is the render time calculated?
b) Date.Now() – performance.timing.domLoading
d) Date.Now() – performance.domLoading
Explanation: The rendering engine parses the HTML and the CSS and displays the parsed content on the screen. The render time is calculated as Date.Now() – performance.timing.domLoading.
9. The object whose properties are inherited by all instances of the class, and properties whose values are functions behaving like instance methods of the class, is _____________
a) Instance object
b) Constructor object
c) Destructor object
d) Prototype object