JavaScript Questions & Answers – JavaScript Minification – II

This set of Javascript Multiple Choice Questions & Answers (MCQs) focuses on “JavaScript Minification – II”.

1. What is scorched-earth optimizations?
a) They optimize based on certain constraints
b) They strip out everything including best practices
c) Based on certain constraints
d) Striping out additional things
View Answer

Answer: b
Explanation: The Closure Compiler is a tool for making JavaScript download and runs faster. Closure Compiler runs through a number of “scorched-earth” optimizations—it unfurls functions, rewrites variable names, and removes functions that are never called (as far as it can tell).

2. The Closure Compiler was introduced by ___________
a) Microsoft
b) Apple
c) Google
d) Yahoo
View Answer

Answer: c
Explanation: The Closure Compiler is a tool for making JavaScript download and runs faster. Instead of compiling from a source language to machine code, it compiles from JavaScript to better JavaScript. The Closure Compiler was introduced by Google.

3. What does the Minify return back to the Script tag?
a) File I/O
b) Minify JavaScript
c) HTTP Request
d) Gzip encoded
View Answer

Answer: d
Explanation: Minification refers to the process of removing unnecessary or redundant data without affecting how the resource is processed by the browser. The Minify sends back the gzip encoded back to the Script tag.
advertisement
advertisement

4. What is the return type of the script tag?
a) File I/O
b) Minify JavaScript
c) HTTP Request
d) Gzip encoded
View Answer

Answer: c
Explanation: The script tag sends the HTTP Request to the Minify. Minify reads the JavaScript file in, minifies it and when it responds it sets the accept encoding HTTP header to gzip, deflate.

5. What does the JS File return?
a) File I/O
b) Minify JavaScript
c) HTTP Request
d) Gzip encoded
View Answer

Answer: b
Explanation: Minification is the process of minimizing code and markup in your web pages and script files. Effectively Minify has built in HTTP static compression. The JS File returns the Minify JavaScript.
Note: Join free Sanfoundry classes at Telegram or Youtube

6. What is the outcome of using R along with minification?
a) Sheer file size reduction
b) File size increase
c) More efficient
d) Compatibility
View Answer

Answer: a
Explanation: Minification refers to the process of removing unnecessary or redundant data without affecting how the resource is processed by the browser. Sheer file size reduction is the only one aspect of the overall determination got from the R along with the minification.

7. Which one of the following is more efficient in terms of the file size reduction?
a) YUI
b) Closure Compiler (advanced)
c) Minify
d) Closure Compiler (simple)
View Answer

Answer: b
Explanation: The Closure Compiler is a tool for making JavaScript download and runs faster. Instead of compiling from a source language to machine code, it compiles from JavaScript to better JavaScript. The Closure Compiler (advanced) has a more number percent of file size reduction by product.
advertisement

8. Which of the following are JavaScript optimizers?
a) JSMin
b) Packer
c) Minify
d) Both JSMin and Packer
View Answer

Answer: d
Explanation: JSMin is a filter which removes comments and unnecessary whitespace from JavaScript files. It typically reduces filesize by half, resulting in faster downloads. JavaScript optimizers such as JSMin and Packer are specially designed for modern web programming techniques and are able to understand and preserve conditional comments, and similar.

9. Which of the following is the approach used to compress HTML in web servers and modern web browsers?
a) Content encoding
b) Content decoding
c) Compression algorithm – DEFLATE
d) Content minification
View Answer

Answer: a
Explanation: Minification refers to the process of removing unnecessary or redundant data without affecting how the resource is processed by the browser. Content encoding is an approach taken by compatible web servers and modern web browsers to compress HTML and related textual content, often in the gzip format.
advertisement

10. Which is the game that requires extremely minified source in the Perl culture?
a) Perl pool
b) Perl golf
c) Both Perl pool and golf
d) Perl bat
View Answer

Answer: b
Explanation: Perl golf is a game where one attempts to write the shortest Perl program to accomplish some goal. In Perl culture, aiming at extremely minified source code is the purpose of the Perl golf game.

Sanfoundry Global Education & Learning Series – Javascript Programming.

If you find a mistake in question / option / answer, kindly take a screenshot and email to [email protected]

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.