JavaScript Questions & Answers – JavaScript Minification – I

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

1. What is the purpose of minifying the JavaScript?
a) To streamline the visits
b) To save the visits
c) To save data
d) To increase the loading time
View Answer

Answer: a
Explanation: To ensure that your first-time visits are as streamlined as possible, we need to minify our JavaScript. Minifying JavaScript results in decreasing the loading time and hence helps in creating a better user experience.

2. From which did Minification concept originate?
a) JavaScript code efficiency
b) JavaScript interpreter
c) JavaScript Compiler
d) JavaScript writer
View Answer

Answer: b
Explanation: Minification is originally based on the idea that the JavaScript interpreter ignores white space, line breaks, and of course comments, so we can save on total file size of our .js files if we remove those unneeded characters.

3. What is the purpose of the product Minify?
a) Storing the data
b) Streamlining the data
c) Proxies the JavaScript file
d) Loading the data
View Answer

Answer: c
Explanation: Minify proxies the JavaScript file; the script tag on the page points to Minify, which is a PHP file.
advertisement
advertisement

4. What does the Minify set the encoding HTTP header?
a) deflate
b) gzip
c) both deflate and gzip
d) inflate
View Answer

Answer: c
Explanation: Minification refers to the process of removing unnecessary or redundant data without affecting how the resource is processed by the browser. Minify reads the JavaScript file in, minifies it and when it responds it sets the accept encoding HTTP header to gzip, deflate.

5. What is in-built in the Minify?
a) Dynamic compression
b) Static compression
c) Static content
d) Dynamic content
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. This is especially useful if your web host doesn’t allow the gzipping of static content.

6. Which folder contains the Minify control panel?
a) /min/builder/
b) /builder/
c) /minify/build
d) /minify/builder
View Answer

Answer: a
Explanation: The minified file version provides the same functionality while reducing the bandwidth of network requests. To navigate to the Minify control panel, it is located in the /min/builder/.

7. Which of the following is the order of Minify process?
a) Remove extraneous characters, gzip the response, Read
b) Remove extraneous characters, Read, gzip the response
c) Read, Remove extraneous characters, gzip the response
d) Read, gzip, extract, remove
View Answer

Answer: c
Explanation: To minify JS, CSS and HTML files, comments and extra spaces need to be removed, as well as crunch variable names so as to minimize code and reduce file size. Minify reads in the content, decorates it by way of removing extraneous characters, and gzips the response.
advertisement

8. YUI Compressor is analogous to ___________
a) Minify
b) JavaScript
c) Both Minify and JavaScript
d) CSS
View Answer

Answer: a
Explanation: The YUI Compressor is JavaScript minifier designed to be 100% safe and yield a higher compression ratio than most other tools. Just like Minify, YUI Compressor strips out all of the unnecessary characters from your JavaScript, including spaces, line breaks, and comments.

9. What type of file is YUI Compressor?
a) Binary file
b) JAR file
c) Text file
d) Assembly file
View Answer

Answer: b
Explanation: The YUI Compressor is JavaScript minifier designed to be 100% safe and yield a higher compression ratio than most other tools. YUI Compressor is a jar file and runs from the command line. Because of this, it is easily integrated into a build process. It looks like this:
java -jar yuicompressor-[version].jar [options] [file name]
advertisement

10. What is the function of a Closure Compiler?
a) Originates the JavaScript
b) Compiles the JavaScript
c) Rewrites JavaScript
d) Links the JavaScript
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. 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).

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.