Explore topic-wise InterviewSolutions in .

This section includes InterviewSolutions, each offering curated multiple-choice questions to sharpen your knowledge and support exam preparation. Choose a topic below to get started.

101.

Which algorithm supports blobs?(a) Structured clone algorithm(b) Double buffer algorithm(c) Chen’s algorithm(d) Retrieval algorithmThis question was posed to me by my school teacher while I was bunking the class.The question is from Blobs in JavaScript topic in chapter Caching, Debugging and Animation of JavaScript

Answer»

Correct choice is (a) Structured clone ALGORITHM

The explanation is: BLOBS REPRESENT data that isn’t necessarily in a JavaScript-native format. Blobs are supported by the structured clone algorithm, which means that you can obtain one from another WINDOW or thread via the message event.

102.

Which side of the image map can be created using JavaScript?(a) Server side(b) Client side(c) Both Server and Client side(d) User sideI have been asked this question in my homework.Origin of the question is Image Map in portion Caching, Debugging and Animation of JavaScript

Answer» RIGHT OPTION is (b) Client side

Best EXPLANATION: JAVASCRIPT is used for the creation of client side data. You can use JavaScript to create client side IMAGE map.
103.

How do we create and preload an image object in JavaScript?(a) Use new keyword(b) Call Image()(c) Both Use new keyword and Call Image()(d) Set image()This question was addressed to me in final exam.I would like to ask this question from Animation in section Caching, Debugging and Animation of JavaScript

Answer»

The correct answer is (C) Both Use NEW KEYWORD and Call Image()

Easiest explanation: The Image() CONSTRUCTOR creates and preloads a new image object. The url is SPECIFIED and the image is preloaded.

104.

What are the benefits of closure compiler?(a) Efficiency(b) Code checking(c) Both Efficiency and Code checking(d) ModularityThe question was asked during an interview.I want to ask this question from The Closure Compiler in chapter Caching, Debugging and Animation of JavaScript

Answer»

The correct choice is (d) Modularity

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 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.

105.

What does the interpreter do when you reference variables in other scopes?(a) Traverses the queue(b) Traverses the stack(c) Finds the bugs(d) Traverse the arrayI have been asked this question in an interview for job.My query is from Cache Variables and Properties across Scope in division Caching, Debugging and Animation of JavaScript

Answer»

The CORRECT option is (B) Traverses the stack

To ELABORATE: The interpreter executes the javascript code. Normally when you reference VARIABLES in other scopes at the global level, in other namespaces, and so on—the interpreter needs to traverse the stack to get to the VARIABLE.

106.

What is the purpose of the simple mode?(a) Removes whitespaces(b) Does not remove white spaces(c) Removes the unwanted words(d) Removes charactersI got this question in exam.I'm obligated to ask this question of The Closure Compiler topic in portion Caching, Debugging and Animation of JavaScript

Answer»

Right CHOICE is (a) Removes whitespaces

The explanation: The javascript minifier compresses the javascript code. In Simple mode it mostly performs LIKE most other minifiers, REMOVING whitespace, line breaks, and COMMENTS.

107.

In which part does the form validation occur?(a) Client(b) Server(c) Both Client and Server(d) User sideI had been asked this question in an internship interview.My doubt is from Validation in division Caching, Debugging and Animation of JavaScript

Answer»

Right option is (b) Server

Explanation: The DATA information from the client side is first SENT to the server side. Form VALIDATION USED to occur at the server after the client had entered all necessary data and then PRESSED the Submit button.

108.

What is the function used to stop capturing the ad hoc timing ?(a) stopadhoc()(b) stopTimer()(c) stopTimeLogging()(d) stophoc()This question was addressed to me by my college director while I was bunking the class.I need to ask this question from Cache Variables and Properties across Scope in portion Caching, Debugging and Animation of JavaScript

Answer»

The CORRECT answer is (c) stopTimeLogging()

To explain: The startTimeLogging() METHOD CAPTURES the timing data for ad hoc, ETC for referencing an uncached document.location. In order to STOP capturing the ad hoc timing for referencing uncached document.location, we call the method stopTimeLogging().

109.

Which will be invoked to create a new worker?(a) Function(b) Destructor(c) Constructor(d) InterfaceThis question was posed to me in examination.My question is from Web Workers in division Caching, Debugging and Animation of JavaScript

Answer»

Correct answer is (c) CONSTRUCTOR

Explanation: When EXECUTING scripts in an HTML page, the page becomes unresponsive until the script is finished. To create a NEW WORKER, just use the Worker() constructor, passing a URL that specifies the JavaScript code that the worker is to run :

110.

During the traversing of the stack when you create a locally scoped variable, where does it go after it goes to the namespace?(a) Window(b) Function(c) Document(d) LocationThis question was addressed to me in class test.The origin of the question is Cache Variables and Properties across Scope in chapter Caching, Debugging and Animation of JavaScript

Answer»

Right answer is (b) Function

Best explanation: Namespace in JavaScript is nothing but a single global object which will contain all our functions, methods, variables and all that. When you CREATE a locally scoped variable for CACHING the reference, the TRAVERSAL reverses in the FORWARD direction and thus, after going to the namespace, it goes to the function.

111.

How do we get the DOM object in JavaScript?(a) getElementbyId()(b) getObject()(c) getElement()(d) getNodeobject()The question was posed to me in an online quiz.The above asked question is from Animation topic in division Caching, Debugging and Animation of JavaScript

Answer»

The correct answer is (a) getElementbyId()

To explain I would say: The getElementbyId() is used to get the DOM object in JavaScript by simply CALLING that function associated with the HTML DOCUMENT. The object in this method GETS referenced by the ID name.

112.

Which of the following is the child object of the JavaScript navigator?(a) Navicat(b) Plugins(c) NetRight(d) PlugsI got this question in my homework.Question is taken from Validation topic in chapter Caching, Debugging and Animation of JavaScript

Answer»

Right answer is (b) Plugins

Explanation: The JavaScript navigator OBJECT is used for BROWSER detection. The JavaScript navigator object INCLUDES a CHILD object CALLED plugins.

113.

Which is the function that calls another function after a time interval?(a) setTimeout()(b) setTime()(c) callafter()(d) timeSet()This question was posed to me by my school teacher while I was bunking the class.This key question is from Animation topic in portion Caching, Debugging and Animation of JavaScript

Answer»

Correct OPTION is (a) SETTIMEOUT()

Explanation: The setTimeout(function, duration) CALLS function after duration MILLISECONDS from now. setInterval(function, milliseconds) is same as setTimeout(), but repeats the execution of the function continuously.

114.

What is the reason for avoiding the attributes property in the HTML DOM?(a) Found unnecessary(b) Attributes don’t have attributes(c) Attributes have attributes(d) Considered irrelevantI had been asked this question during an interview.My doubt stems from HTML DOM topic in chapter Caching, Debugging and Animation of JavaScript

Answer»

Correct answer is (b) Attributes don’t have attributes

For explanation I would say: When a web page is loaded, the BROWSER creates a Document Object MODEL of the page. The reason for AVOIDING the attributes property in the HTML DOM is because Attributes don’t have attributes.

115.

Which of the following functions are synchronous?(a) load()(b) require()(c) both load() and require()(d) create()This question was posed to me by my school principal while I was bunking the class.This is a very interesting question from Web Workers in division Caching, Debugging and Animation of JavaScript

Answer» CORRECT option is (C) both load() and require()

The best explanation: JavaScript has two synchronous load() and require(). The load() method loads data from a SERVER and puts the RETURNED data into the SELECTED element.
116.

During the traversing through the stack, where does it go after it goes to the namespace?(a) Window(b) Function(c) Document(d) LocationThis question was posed to me during an internship interview.I'm obligated to ask this question of Cache Variables and Properties across Scope in section Caching, Debugging and Animation of JavaScript

Answer»

Correct answer is (a) Window

For explanation I WOULD say: Namespace in JavaScript is nothing but a SINGLE global OBJECT which will contain all our functions, methods, variables and all that. During the TRAVERSAL in the stack manner, after going to the namespace, it GOES to the Window.

117.

Which is the function used to call a function in every time duration?(a) callafter()(b) setInterval()(c) setTimeout()(d) setTime()The question was asked in my homework.I'd like to ask this question from Animation in portion Caching, Debugging and Animation of JavaScript

Answer» CORRECT OPTION is (b) SETINTERVAL()

Explanation: The setInterval(function, DURATION) CALLS function after every duration milliseconds.
118.

What is the work of the form control elements in the HTML DOM?(a) User Interface elements(b) All the possible elements(c) Debugging elements(d) Collecting elementsThis question was posed to me during an interview.My question is from HTML DOM in portion Caching, Debugging and Animation of JavaScript

Answer»

Correct OPTION is (a) User Interface elements

Easiest EXPLANATION: Form control elements: The form object CONTAINS all the elements defined for that object such as TEXT fields, buttons, radio buttons, and checkboxes. The elements COLLECTION returns a collection of all elements in a form.

119.

What is the purpose of XMLHttpRequest?(a) Multiple loading(b) Load content by loading new document(c) Load content without loading new document(d) Repetitive loadingI got this question in exam.Question is from HTML APIs in chapter Caching, Debugging and Animation of JavaScript

Answer»

Right OPTION is (c) LOAD content without loading new document

To elaborate: The XMLHTTPREQUEST object can be used to request data from a web server. XMLHttpRequest makes it possible to load ADDITIONAL content from the Web without loading a new document, a core component of AJAX.

120.

What is the central concept of JavaScript memory management?(a) Reliability(b) Reachability(c) Efficiency(d) TransparencyThe question was asked in final exam.This is a very interesting question from JavaScript and Memory Leak in chapter Caching, Debugging and Animation of JavaScript

Answer»

Right choice is (b) Reachability

The explanation: The central concept of JAVASCRIPT memory MANAGEMENT is a concept of reachability. The main cause for leaks in garbage collected languages are UNWANTED references.

A distinguished set of objects are assumed to be reachable: these are known as the roots. Typically, these include all the objects referenced from anywhere in the call stack (that is, all local VARIABLES and parameters in the functions currently being invoked), and any global variables.

Objects are kept in memory while they are accessible from roots through a reference or a CHAIN of references.

121.

Which of the following is a subtype of Blob?(a) Elemental Object(b) Create Object(c) Data Object(d) File ObjectI had been asked this question in an international level competition.The doubt is from Blobs in JavaScript topic in portion Caching, Debugging and Animation of JavaScript

Answer» CORRECT ANSWER is (d) File Object

The best I can EXPLAIN: The File interface is based on Blob, inheriting blob functionality and expanding it to support files on the user’s system. The client-side JAVASCRIPT File object is a subtype of Blob: a File is just a Blob of data with a name and a modification DATE.
122.

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 codeThe question was asked in quiz.The doubt is from The Closure Compiler in section Caching, Debugging and Animation of JavaScript

Answer»

Right option is (c) Dynamically generating HTML in Java and JavaScript

The BEST explanation: 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”.

123.

In how many modes can the closure compiler be run?(a) 1(b) 2(c) 3(d) 4This question was posed to me in quiz.Asked question is from The Closure Compiler in section Caching, Debugging and Animation of JavaScript

Answer»

Right ANSWER is (b) 2

To explain: 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:

Simple mode

Advanced mode.

124.

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 speedThis question was addressed to me by my college professor while I was bunking the class.The origin of the question is The Closure Compiler in chapter Caching, Debugging and Animation of JavaScript

Answer»

Correct answer is (b) Reduces the size of the JavaScript FILES

Explanation: 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.