JavaScript Questions & Answers – Performance Measures in JavaScript – II

This set of JavaScript Interview Questions and Answers for Experienced people focuses on “Performance Measures in JavaScript – II”.

1. How can we define the term Performance?
a) Speed of the input takes in
b) Speed of the output display
c) Speed at which application functions
d) Speed of data transmission
View Answer

Answer: c
Explanation: Performance refers to the speed at which an application functions. It is a multifaceted aspect of quality. Better performance results in better user experience.

2. When is an application said to show a web performance?
a) Time to respond
b) Time to load
c) Time to send a request
d) Time to receive data
View Answer

Answer: b
Explanation: Web performance refers to the speed in which web pages are downloaded and displayed on the user’s web browser. When we’re talking about web applications, the time it takes your application to be presented to your users is what we will call web performance.

3. When is an application said to show a runtime performance?
a) Speed of response to user
b) Speed of user request
c) Speed of sending data
d) Speed of receiving data
View Answer

Answer: a
Explanation: The speed at which your application responds to your users’ interactions is what we’ll call runtime performance. Better runtime performance results in better user experience.
advertisement
advertisement

4. What does the span of time waiting for the page to be useful depending on?
a) Runtime performance
b) Web performance
c) Speed
d) Runtime performance & Speed
View Answer

Answer: b
Explanation: Web performance refers to the speed in which web pages are downloaded and displayed on the user’s web browser. The span of time that you are waiting for the page to be usable depends on web performance.

5. What is the advantage of the code produced graphics being smaller than the images themselves?
a) Bandwidth saving
b) Increase in bandwidth
c) Dynamic advantages
d) Static advantages
View Answer

Answer: a
Explanation: The code used to produce graphics on the client side is typically much smaller than the images themselves, creating substantial bandwidth savings. This also helps in increasing web performance.

6. In order to skip or seek to the desired location in a sound or video, which property becomes helpful?
a) audioSkip
b) currentTime
c) videoSkip
d) skiptoTime
View Answer

Answer: b
Explanation: The currentTime property sets or returns the current position (in seconds) of the audio/video playback. In addition to starting and stopping sound and video, you can skip (or “seek”) to the desired location within the media by setting the currentTime property.

7. Which of the following shows a better runtime performance for coalescing functionality, using functions, and using objects?
a) Firefox unwoundfun
b) Firefox UsingFunct
c) Firefox UsingObject
d) Firefox UsingStruct
View Answer

Answer: b
Explanation: When we compare the runtime performance for coalescing functionality, using functions, and using objects, the Firefox UsingFunct shows better performance. UsingFunct improves runtime performance and inturn the user experience.
advertisement

8. Which of the following shows a poorer runtime performance for coalescing functionality, using functions, and using objects?
a) Firefox unwoundfun
b) Firefox UsingFunct
c) Firefox UsingObject
d) Firefox UsingStruct
View Answer

Answer: a
Explanation: When we compare the runtime performance for coalescing functionality, using functions, and using objects, the Firefox UsingFunct shows a poorer performance. This results in poor user experience.

9. In how many modes can the Closure compiler be run?
a) 2
b) 3
c) 4
d) 5
View Answer

Answer: a
Explanation: Closure Compiler can be run in either of two modes:

  • In Simple mode it mostly performs like most other minifiers, removing whitespace, line breaks, and comments
  • In Advanced mode it rewrites the JavaScript by renaming variables and functions from longer descriptive names to single letters to save file size, and it inlines functions, coalescing them into single functions wherever it determines that it can
advertisement

10. What is the purpose of the advanced mode in the Closure compiler?
a) Removing the variables and other parameters
b) Renaming the variables and other parameters
c) Slight alteration to improve the runtime performance
d) Calls the function
View Answer

Answer: b
Explanation: In Advanced mode, the Closure Compiler rewrites the JavaScript by renaming variables and functions from longer descriptive names to single letters to save file size, and it inlines functions, coalescing them into single functions wherever it determines that it can.

Sanfoundry Global Education & Learning Series – Javascript Programming.

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.