JavaScript Questions & Answers – Invocation of the Performance Object

This set of Basic JavaScript Questions and Answers focuses on “Invocation of the Performance Object”.

1. Which of the following property gives access to the JavaScript memory usage data?
a) performance.memory
b) memory(performance)
c) performance(memory)
d) performance()
View Answer

Answer: a
Explanation: The property performance.memory gives access to the JavaScript memory usage data. It returns an object of type ObjectObject.

2. What is the purpose of the timing property in the window.performance object?
a) Time of navigation event
b) Time of page load event
c) Time of navigation and page load event
d) Time of scrolling
View Answer

Answer: c
Explanation: Each performance.timing attribute shows the time of a navigation event (such as when the page was requested) or page load event (such as when the DOM began loading), measured in milliseconds. The legacy Performance.timing read-only property returns a PerformanceTiming object containing latency-related performance information.

3. Which of the following property is associated with the Response event?
a) responseStart
b) responseEnd
c) both responseStart and responseEnd
d) responsiveStart
View Answer

Answer: c
Explanation: PerformanceTiming.responseStart read-only property returns an unsigned long long representing the moment in time (in milliseconds since the UNIX epoch) when the browser received the first byte of the response from the server, cache, or local resource. The properties associated with the Response event are:

  • responseStart
  • responseEnd.
advertisement
advertisement

4. Which of the following computation is correct to calculate the time taken for page load once the page is received from the server?
a) responseEnd-loadEventEnd
b) loadEventEnd-responseEnd
c) loadEventEnd/responseEnd
d) responseEnd/loadEventEnd
View Answer

Answer: b
Explanation: The legacy PerformanceTiming.loadEventEnd read-only property returns an unsigned long representing the moment, in milliseconds since the UNIX epoch, when the load event handler terminated, that is when the load event is completed. The time taken for page load once the page is received from the server: loadEventEnd-responseEnd.

5. Which of the following property is associated with the Processing event?
a) domComplete
b) domContentLoaded
c) domInteractive
d) domload
View Answer

Answer: d
Explanation: PerformanceTiming.domComplete read-only property returns an unsigned long long representing the moment, in miliseconds since the UNIX epoch, when the parser finished its work on the main document. The following properties are associated with the Processing event:

  • domComplete
  • domContentLoaded
  • domInteractive
  • domLoading
  • unLoadEnd.
Note: Join free Sanfoundry classes at Telegram or Youtube

6. What does it indicate when the type attribute of the navigation object is set to 2?
a) Navigation by moving back through history
b) Navigation by moving forward through history
c) Navigation by moving back & forward through history
d) Navigation by moving in favorites
View Answer

Answer: c
Explanation: The navigator object contains information about the browser. When the type attribute of the navigation object is set to 2, it means that the navigation is done by moving back or forward through history.

7. What does the method Performance.now() return?
a) DOMTimeStamp
b) DOMHighResTimeStamp
c) DOM\Stamp
d) TimeStamp
View Answer

Answer: b
Explanation: The Performance.now() method returns a DOMHighResTimeStamp, measured in milliseconds, accurate to one thousandth of a millisecond equal to the number of milliseconds since the PerformanceTiming.navigationStart property and the call to the method. The returned value represents the time elapsed since the time origin.
advertisement

8. Which of the following is a read-only property?
a) PerformanceTiming.navigationStart
b) PerformanceTiming.fetchStart
c) PerformanceTiming.navigationStart & PerformanceTiming.fetchStart
d) PerformanceTiming.responseStart
View Answer

Answer: c
Explanation: PerformanceTiming.navigationStart read-only property returns an unsigned long long representing the moment, in miliseconds since the UNIX epoch, right after the prompt for unload terminates on the previous document in the same browsing context. If there is no previous document, this value will be the same as PerformanceTiming.fetchStart. Both PerformanceTiming.navigationStart and also the PerformanceTiming.fetchStart are a read-only properties.

9. Which of the following is an interface?
a) Time
b) Timing
c) Performance
d) PerformanceTiming
View Answer

Answer: d
Explanation: Performance.timing read-only property returns a PerformanceTiming object containing latency-related performance information. PerformanceTiming is an interface in JavaScript.
advertisement

10. How many properties are associated with the Response event?
a) 1
b) 2
c) 3
d) 4
View Answer

Answer: b
Explanation: There are a total of 2 properties associated with the Response event namely:

  • PerformanceTiming.responseEnd
  • PerformanceTiming.responseStart.

PerformanceTiming.responseStart read-only property returns an unsigned long long representing the moment in time (in milliseconds since the UNIX epoch) when the browser received the first byte of the response from the server, cache, or local resource.

Sanfoundry Global Education & Learning Series – Javascript Programming.

To practice basic questions and answers on all areas of JavaScript, here is complete set of 1000+ Multiple Choice Questions and Answers on Javascript.

advertisement
advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.