Invocation And Performance Navigation(Javascript ) Questions and Answers

Question 1. What is the purpose of the timing property in the window.performance object?
  1.    Time of navigation event
  2.    Time of page load event
  3.    Time of navigation and page load event
  4.    None of the mentioned
Explanation:-
Answer: Option C. -> Time of navigation and page load event
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.

Question 2. Which of the following property gives access to the JavaScript memory usage data?
  1.    performance.memory
  2.    memory(performance)
  3.    performance(memory)
  4.    none of the mentioned
Explanation:-
Answer: Option A. -> performance.memory
The property performance.memory gives access to the JavaScript memory usage data.

Question 3. Which of the following property is associated with the Response event?
  1.    responseStart
  2.    responseEnd
  3.    both responseStart and responseEnd
  4.    none of the mentioned
Explanation:-
Answer: Option C. -> both responseStart and responseEnd
The properties associated with the Response event are :
1. responseStart
2. responseEnd.

Question 4. Which of the following computation is correct to calculate the time taken for page load once the page is received from the server?
  1.    responseEnd-loadEventEnd
  2.    loadEventEnd-responseEnd
  3.    loadEventEnd/responseEnd
  4.    responseEnd/loadEventEnd
Explanation:-
Answer: Option B. -> loadEventEnd-responseEnd
The time taken for page load once the page is received from the server: loadEventEnd-responseEnd.

Question 5. Which of the following property is associated with the Processing event?
  1.    domComplete
  2.    domContentLoaded
  3.    domInteractive
  4.    none of the mentioned
Explanation:-
Answer: Option D. -> none of the mentioned
The following properties are associated with the Processing event :
1. domComplete
2. domContentLoaded
3. domInteractive
4. domLoading
5. unLoadEnd

Question 6. What is the purpose of lazy loading?
  1.    Immediate loading is necessary
  2.    Loading under command
  3.    Immediate loading is not necessary
  4.    None of the mentioned
Explanation:-
Answer: Option C. -> Immediate loading is not necessary
Lazy loading is a kind of loading in which we don’t need our JavaScript code to be available as soon as the page loads.

Question 7. Where is the external JavaScript placed in the case of lazy loading?
  1.    After window.onload event
  2.    Before window.onload event
  3.    All of the mentioned
  4.    None of the mentioned
Explanation:-
Answer: Option A. -> After window.onload event
When we don’t need our JavaScript code to be available as soon as the page loads, we can script-load our external JavaScript after the window.onload event.

Question 8. Which of the following is an attribute to the script object?
  1.    onclick
  2.    onload
  3.    onshow
  4.    all of the mentioned
Explanation:-
Answer: Option B. -> onload
Only onload is an attribute to the script object.

Question 9. What are the parameters of the attachEvent function?
  1.    Function
  2.    Function, Event
  3.    Event, Function
  4.    Event
Explanation:-
Answer: Option C. -> Event, Function
The attachEvent function accepts two parameters: the event to attach to, and the function to invoke when the event occurs.

Question 10. What is the result when the showPerformanceMetrics() is called before loading the remote script?
  1.    Throws an exception
  2.    Throws an error
  3.    It will load by itself
  4.    None of the mentioned
Explanation:-
Answer: Option B. -> Throws an error
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.