250+ TOP MCQs on The Closure Compiler and Answers

Javascript Multiple Choice Questions on “The Closure Compiler”.

1. In how many modes can the closure compiler be run?
a) 1
b) 2
c) 3
d) 4

Answer: b
Clarification: The Closure Compiler is a tool for making JavaScript download and run faster. There are totally 2 modes in which the closure compiler can be run namely:

  1. Simple mode
  2. Advanced mode.

2. What is the purpose of the simple mode?
a) Removes whitespaces
b) Does not remove white spaces
c) Removes the unwanted words
d) Removes characters

Answer: a
Clarification: The javascript minifier compresses the javascript code. In Simple mode it mostly performs like most other minifiers, removing whitespace, line breaks, and comments.

3. What is a closure compiler UI?
a) Run time application
b) Web application
c) Standalone application
d) Changes structures

Answer: b
Clarification: 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. A closure compiler UI is a web application.

4. What are the benefits of closure compiler?
a) Efficiency
b) Code checking
c) Both Efficiency and Code checking
d) Modularity

Answer: d
Clarification: 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 is highly beneficial in terms of:

  • Efficiency: The Closure Compiler reduces the size of your JavaScript files and makes them more efficient, helping your application to load faster and reducing your bandwidth needs.
  • Code checking: The Closure Compiler provides warnings for illegal JavaScript and warnings for potentially dangerous operations, helping you to produce JavaScript that is less buggy and easier to maintain.

5. In what way is the closure compiler efficient?
a) Increases the size of the JavaScript files
b) Reduces the size of the JavaScript files
c) Reduces the execution time
d) Reduces the speed

Answer: b
Clarification: The Closure Compiler is a tool for making JavaScript download and runs faster. The Closure Compiler reduces the size of your JavaScript files and makes them more efficient, helping your application to load faster and reducing your bandwidth needs.

6. In which way can the closure compiler can be used?
a) Open source
b) Run time application
c) Web application
d) Only Open source and Web application

Answer: d
Clarification: Closure compiler parses your JavaScript, analyzes it, removes dead code and rewrites and minimizes what’s left. You can use the Closure Compiler as:

  • An open source Java application that you can run from the command line.
  • A simple web application.
  • A RESTful API.

7. What is the purpose of the advanced mode in the closure compiler?
a) Renames variables
b) Renames function
c) Both Renames variables and function
d) Changes structures

Answer: c
Clarification: 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.

8. Why is a closure template used?
a) Statically updating in JavaScript
b) To increase the efficiency and convenience
c) Dynamically generating HTML in Java and JavaScript
d) Changing code

Answer: c
Clarification: Instead of compiling from a source language to machine code, closure templates compiles from JavaScript to better JavaScript. Closure compiler provides with the basic facilities of removing spaces and dead code. Closure Templates are a templating system for dynamically generating HTML in both Java and JavaScript. Because the language was apparently referred to as “Soy” internal to Google, and “Soy” remains in some of the documentation and classes, sometimes Closure Templates are referred to as “Soy Templates”.

9. In what way does the closure compiler help in checking the code?
a) Warnings
b) Suddenly aborts
c) Rejects malicious inputs
d) Terminates the execution

Answer: a
Clarification: Closure compiler parses your JavaScript, analyzes it, removes dead code and rewrites and minimizes what’s left. The Closure Compiler provides warnings for illegal JavaScript and warnings for potentially dangerous operations, helping you to produce JavaScript that is less buggy and easier to maintain.

10. What is the function of the closure compiler?
a) Download faster
b) Run faster
c) Both Download faster and Run faster
d) Changes the code

Answer: c
Clarification: The Closure Compiler is a tool for making JavaScript download and runs faster. It parses your JavaScript, analyzes it, removes dead code and rewrites and minimizes what’s left. It also checks syntax, variable references, and types, and warns about common JavaScript pitfalls.

Leave a Reply

Your email address will not be published. Required fields are marked *