JavaScript Questions & Answers – JavaScript with YSlow

«
»

This set of Javascript Multiple Choice Questions & Answers (MCQs) focuses on “JavaScript with YSlow”.

1. How does PhantonJS use YSlow?
a) Queries
b) Statements
c) Command Line Prompt
d) Command Line Script
View Answer

Answer: d
Explanation: YSlow for PhantomJS is a command line script that allows page performance analysis from live URLs, unlike YSlow for Command Line (HAR) where a pre-generated HAR file is needed in order to analyze page performance.
advertisement

2. What are the two output formats YSlow uses?
a) TAP, JUnit
b) JIT, TRD
c) JKP, RFD
d) TIP, KIT
View Answer

Answer: a
Explanation: YSlow for PhantomJS is a command line script that allows page performance analysis from live URLs. YSlow for PhantomJS introduces new output formats for automated test frameworks: TAP (Test Anything Protocol) and JUnit.

3. Initially, YSlow was an extension of which browser?
a) Chrome
b) Firefox
c) IE
d) Opera
View Answer

Answer: b
Explanation: Initially, YSlow was an extension of Firefox. YSlow for Firefox needs Firebug to run.
advertisement
advertisement

4. Which of the following can be used for a deeper analysis of the web page’s performance?
a) WebPageTest
b) FireBug
c) YSlow
d) WebPageTest & FireBug
View Answer

Answer: c
Explanation: YSlow analyzes web page performance by examining all the components on the page, including components dynamically created by using JavaScript. It measures the page’s performance and offers suggestions for improvement.

5. How many rules are there in the YSlow version 2.0?
a) 23
b) 21
c) 27
d) 33
View Answer

Answer: a
Explanation: There are totally 23 rules in the ruleset of YSlow (V2) namely :

  1. Minimize HTTP Requests
  2. Use a Content Delivery Network
  3. Avoid empty src or href
  4. Add an Expires or a Cache-Control Header
  5. Gzip Components
  6. Put StyleSheets at the Top
  7. Put Scripts at the Bottom
  8. Avoid CSS Expressions
  9. Make JavaScript and CSS External
  10. Reduce DNS Lookups
  11. Minify JavaScript and CSS
  12. Avoid Redirects
  13. Remove Duplicate Scripts
  14. Configure ETags
  15. Make AJAX Cacheable
  16. Use GET for AJAX Requests
  17. Reduce the Number of DOM Elements
  18. No 404s
  19. Reduce Cookie Size
  20. Use Cookie-Free Domains for Components
  21. Avoid Filters
  22. Do Not Scale Images in HTML
  23. Make favicon.ico Small and Cacheable
advertisement

6. Which of the following is mandatory to run before running YSlow?
a) WebPageTest
b) FireBug
c) Both WebPageTest and FireBug
d) Mozilla
View Answer

Answer: b
Explanation: YSlow analyzes web page performance by examining all the components on the page, including components dynamically created by using JavaScript. It is mandatory to run FireBug before running YSlow.

7. How does the YSlow for Mobile work as?
a) Bookwise
b) Booklet
c) Bookmarklet
d) Bookmark
View Answer

Answer: c
Explanation: The YSlow for Mobile works as bookmaklet. Bookmarklet is a JavaScript code stored as the URL of a bookmark in a web browser.
advertisement

8. Which network allows you to distribute static assets like images, etc?
a) Content Delivery Network
b) Content Receiving Network
c) System Area Network
d) Local area network
View Answer

Answer: a
Explanation: A content delivery network (CDN) allows you to distribute your static assets like images, JavaScript files and stylesheets to geographically distributed servers. This gets the content of your page to your user’s browser faster.

9. What are the three important manipulations done in a for loop on a loop variable?
a) Updation, Incrementation, Initialization
b) Initialization,Testing, Updation
c) Testing, Updation, Testing
d) Initialization,Testing, Incrementation
View Answer

Answer: b
Explanation: In a for loop, the initialization, the test, and the update are the three crucial manipulations of a loop variable. Firstly the variable is created then it’s first tested then updated.
advertisement

10. What convenience does the following JavaScript code?

let succ = function(x) x+1, yes = function() true, no = function() false;

What convenience does the above code snippet provide?
a) Functional behaviour
b) Modular behaviour
c) No convenience
d) Shorthand expression
View Answer

Answer: a
Explanation: The functions defined in this way behave exactly like functions defined with curly braces and the return keyword. The functions can be defined in a shorthand expression.

Sanfoundry Global Education & Learning Series – Javascript Programming.

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

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!

advertisement
advertisement
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He is Linux Kernel Developer & SAN Architect and is passionate about competency developments in these areas. He lives in Bangalore and delivers focused training sessions to IT professionals in Linux Kernel, Linux Debugging, Linux Device Drivers, Linux Networking, Linux Storage, Advanced C Programming, SAN Storage Technologies, SCSI Internals & Storage Protocols such as iSCSI & Fiber Channel. Stay connected with him @ LinkedIn | Youtube | Instagram | Facebook | Twitter