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.

1.

Which of the following is a web application API framework?(a) Dojo(b) YUI(c) GWT(d) jQueryThe question was posed to me by my school teacher while I was bunking the class.I need to ask this question from Client-Side Frameworks topic in chapter Server-Side and Client-Side Scripting of JavaScript

Answer»

Right answer is (C) GWT

For explanation: GWT, the Google Web TOOLKIT defines a web application API in Java and provides a COMPILER to translate your Java programs into compatible client-side JavaScript whereas Google CLOSURE Tools is a set of tools to help developers build rich web applications with JavaScript.

2.

Which of the following framework was used by Google for Gmail?(a) Dojo(b) GWT(c) Closure(d) YUIThis question was posed to me in an internship interview.The above asked question is from Client-Side Frameworks in portion Server-Side and Client-Side Scripting of JavaScript

Answer»

Correct option is (c) Closure

The explanation is: The Closure LIBRARY is the client-side library that Google uses for Gmail, Google Docs, and other web APPLICATIONS. This library is INTENDED to be USED with the Closure compiler, which strips out unused library functions.

3.

What are the two incompatible versions of YUI?(a) YUI1 and YUI2(b) YUI2 and YUI4(c) YUI1 and YUI3(d) YUI2 and YUI3The question was asked during an interview for a job.My question comes from Client-Side Frameworks in portion Server-Side and Client-Side Scripting of JavaScript

Answer»

Correct choice is (a) YUI1 and YUI2

The best I can explain: YUI STANDS for yahoo user interface. Like Dojo, it is a LARGE, all-encompassing library with language utilities, DOM utilities, UI widgets, and so on. There are actually two incompatible VERSIONS of YUI, known as YUI 2 and YUI 3.

4.

What does Dojo and YUI have in common?(a) Facilitates DOM utilities and UI Widgets(b) Does not facilitates DOM utilities and UI Widgets(c) Client-side library(d) Server-side libraryThe question was posed to me in final exam.My question is based upon Client-Side Frameworks in section Server-Side and Client-Side Scripting of JavaScript

Answer»

The correct CHOICE is (a) Facilitates DOM utilities and UI Widgets

Explanation: Like Dojo, it is a large, all-encompassing library with language utilities, DOM utilities, UI widgets, and so on. There are ACTUALLY two INCOMPATIBLE versions of YUI, known as YUI 2 and YUI 3.

5.

What is the purpose of the Dojo framework?(a) Focuses on DOM and Ajax utilities(b) Advertises incredible depth(c) Ajax utilities(d) ModularI have been asked this question in an international level competition.Enquiry is from Client-Side Frameworks topic in portion Server-Side and Client-Side Scripting of JavaScript

Answer»

Right choice is (b) Advertises incredible DEPTH

To elaborate: The Dojo toolkit is an open-source modular toolkit containing a JavaScript library that is designed for rapidly creating JavaScript/Ajax-based websites and cross-platform applications. Dojo is a large FRAMEWORK that advertises its “incredible depth.” It INCLUDES an extensive set of UI widgets, a package system, a data abstraction LAYER, and more.

6.

Which is the in-house library of Yahoo!?(a) Dojo(b) YUI(c) Prototype(d) ClosureI have been asked this question at a job interview.My enquiry is from Client-Side Frameworks topic in chapter Server-Side and Client-Side Scripting of JavaScript

Answer»

Correct choice is (b) YUI

Explanation: YUI is the in-house library of Yahoo!, and it is used on their HOME page. The Yahoo User Interface Library is a discontinued open-source JavaScript library for building RICHLY INTERACTIVE web applications using TECHNIQUES such as Ajax, DHTML, and DOM SCRIPTING.

7.

Which of the following frameworks focuses on DOM and Ajax utilities?(a) jQuery(b) Prototype(c) Dojo(d) Both jQuery and PrototypeThis question was addressed to me during an interview.Origin of the question is Client-Side Frameworks topic in chapter Server-Side and Client-Side Scripting of JavaScript

Answer»

Correct option is (d) Both jQuery and PROTOTYPE

Easiest explanation: DOM stands for data object MODULATION. The Prototype library focuses on DOM and Ajax utilities like jQuery does, and adds quite a few core-language utilities as well.

8.

Which of the following is not a framework?(a) jQuery(b) .NET(c) JavaScript(d) CocoaI got this question in an internship interview.I'd like to ask this question from Client-Side Frameworks topic in chapter Server-Side and Client-Side Scripting of JavaScript

Answer» RIGHT answer is (c) JavaScript

The explanation is: ONE of the most POPULAR frameworks is jQuery which is used in WEB development. Here, JavaScript is a scripting language and not a framework.
9.

The libraries that build a new higher-level API for client-side programming is ____________(a) Library(b) Framework(c) APIs(d) ScriptI have been asked this question in an online quiz.I want to ask this question from Client-Side Frameworks topic in section Server-Side and Client-Side Scripting of JavaScript

Answer»

Correct option is (b) Framework

Best EXPLANATION: Many WEB developers find it USEFUL to build their web applications on top of a client side framework library. These libraries are “frameworks” in the sense that they build a new higher-level API for client-side programming on top of the standard and proprietary APIs offered by web browsers: once you adopt a framework, your code NEEDS to be written to use the APIs defined by that framework.

10.

What is the JavaScript code snippet to find all container elements with class “reveal”?(a) var elements = document.getElementsByClassName(“reveal”);(b) var elements = document.getElementByClassName(“reveal”);(c) var elements = document.getElementByName(“reveal”);(d) var elements = document.getElementsClassName(“reveal”);I have been asked this question in an online quiz.This interesting question is from JavaScript in Web Browsers in division Server-Side and Client-Side Scripting of JavaScript

Answer» CORRECT choice is (a) var elements = document.GETELEMENTSBYCLASSNAME(“reveal”);

The best I can explain: The getElementsByClassName() method RETURNS a collection of all elements in the document with the specified class NAME, as a NODELIST object. The above code snippet finds all container elements with class “reveal”.
11.

Which of the following is not an object?(a) Element(b) Location(c) Position(d) WindowThis question was posed to me in a national level competition.This intriguing question originated from JavaScript in Web Browsers topic in section Server-Side and Client-Side Scripting of JavaScript

Answer»

Correct choice is (c) Position

To EXPLAIN I would SAY: There is no OBJECT called Position. Whereas elements, location and WINDOW are a predefined object in JavaScript.

12.

What is the JavaScript code snippet to update the content of the timestamp element when the user clicks on it?(a) timestamp.onLoad = function() { this.innerHTML = new Date().toString(); }(b) timestamp.onclick = function() { this.innerHTML = new Date().toString(); }(c) timestamp.onload = function() { this.innerHTML = new Date().toString(); }(d) timestamp.onclick = function() { innerHTML = new Date().toString(); }The question was posed to me in final exam.Question is from JavaScript in Web Browsers in division Server-Side and Client-Side Scripting of JavaScript

Answer»

Correct ANSWER is (b) timestamp.onclick = function() { this.innerHTML = new Date().toString(); }

The best I can explain: onclick() function is used to handle events when the user clicks on the mouse. The above CODE snippet updates the content of the timestamp ELEMENT when the user clicks on it.

13.

When a program contains extensive use of event handlers, which of the following is necessary?(a) Modular functions(b) Nested functions(c) Split up programs(d) Global variablesThis question was posed to me during an interview for a job.This interesting question is from JavaScript in Web Browsers topic in chapter Server-Side and Client-Side Scripting of JavaScript

Answer»

The correct option is (b) Nested FUNCTIONS

The EXPLANATION is: Nested functions are those functions in which one function is defined INSIDE ANOTHER function. Nested functions are common in client-side JavaScript, because of its extensive use of event HANDLERS.

14.

Which handler is triggered when the content of the document in the window is stable and ready for manipulation?(a) onload(b) manipulate(c) create(d) onkeypressThis question was posed to me by my college director while I was bunking the class.This interesting question is from JavaScript in Web Browsers topic in section Server-Side and Client-Side Scripting of JavaScript

Answer»

The correct choice is (a) ONLOAD

The best explanation: One of the most IMPORTANT EVENT handlers is the onload handler of the Window object. It is TRIGGERED when the content of the document displayed in the window is stable and ready to be manipulated. JavaScript code is commonly wrapped within an onload event handler.

15.

What is the purpose of the event handlers in the JavaScript?(a) Adds innerHTML page to the code(b) Performs handling of exceptions and occurrences(c) Allows JavaScript code to alter the behaviour of windows(d) Change the server locationThis question was posed to me by my school teacher while I was bunking the class.Origin of the question is JavaScript in Web Browsers topic in division Server-Side and Client-Side Scripting of JavaScript

Answer» RIGHT OPTION is (c) Allows JavaScript code to alter the BEHAVIOUR of windows

The explanation: Event handlers ALLOW JavaScript code to alter the BEHAVIOR of windows, of documents, and of the elements that make up those documents.
16.

What are the properties supporting CSS styles for a document element?(a) style and font(b) style and className(c) size and style(d) className and fontI have been asked this question in an international level competition.This key question is from JavaScript in Web Browsers topic in chapter Server-Side and Client-Side Scripting of JavaScript

Answer»

Correct option is (B) style and className

To explain I would SAY: Each Element object has style and className properties that allow scripts to specify CSS styles for a document element or to alter the CSS CLASS names that apply to the element. firstChild returns the FIRST child node as an element node, a text node or a comment node (depending on which ONE’s first).

17.

Which of the following object belongs to the style property?(a) Element(b) Window(c) Location(d) DynamicI got this question in an internship interview.My question is based upon JavaScript in Web Browsers topic in section Server-Side and Client-Side Scripting of JavaScript

Answer»

Right ANSWER is (a) Element

Easiest explanation: Each Element object has style and className PROPERTIES that allow scripts to specify CSS STYLES for a DOCUMENT element or to alter the CSS class names that APPLY to the element.

18.

What is the property to access the first child of a node?(a) timestamp.Child1(b) timestamp.Child(1)(c) timestamp.Child(0)(d) timestamp.firstChildThe question was asked during an online interview.I'd like to ask this question from JavaScript in Web Browsers in chapter Server-Side and Client-Side Scripting of JavaScript

Answer»

Correct answer is (d) timestamp.firstChild

The EXPLANATION is: The first child of a node can be accessed USING the firstChild property. firstChild RETURNS the first child node as an element node, a TEXT node or a comment node (depending on which ONE’s first).

19.

Which is the property that represents the content displayed in the window?(a) document(b) content(c) window(d) frameThis question was addressed to me in a national level competition.Question is from JavaScript in Web Browsers topic in portion Server-Side and Client-Side Scripting of JavaScript

Answer»

Right answer is (a) DOCUMENT

The BEST I can explain: One of the most important properties of the Window OBJECT is document: it refers to a Document object that represents the CONTENT DISPLAYED in the window.

20.

When will the window property come into play?(a) Representation convenience(b) Use as an extension of other objects(c) Use objects in the Window object(d) Refer to window object itselfI have been asked this question in quiz.My doubt stems from JavaScript in Web Browsers in chapter Server-Side and Client-Side Scripting of JavaScript

Answer» CORRECT CHOICE is (d) Refer to window object itself

To explain I WOULD say: The Window object has a property NAMED window that always refers to itself. You can use this property if you need to refer to the window object itself.
21.

The setTimeout() method is used to _______________(a) Make the event sleep(b) Register a function to be invoked after a certain time(c) Invoke an event after a certain time(d) Time for iterationThe question was posed to me by my school teacher while I was bunking the class.The above asked question is from JavaScript in Web Browsers in portion Server-Side and Client-Side Scripting of JavaScript

Answer»

Correct answer is (b) Register a FUNCTION to be INVOKED after a certain time

Easy explanation: The SETTIMEOUT(), which registers a function to be invoked after a specified amount of time. The setTimeout() method CALLS a function or evaluates an EXPRESSION after a specified number of milliseconds.

22.

Which of the following is a global object?(a) Register(b) Location(c) Window(d) PositionI have been asked this question in an international level competition.Query is from JavaScript in Web Browsers in portion Server-Side and Client-Side Scripting of JavaScript

Answer»

Correct OPTION is (C) Window

Explanation: In client-side JavaScript, the Window object is also the GLOBAL object. This means that the Window object is at the top of the scope chain and that its properties and methods are effectively global VARIABLES and global functions.

23.

Which Window object method is used to display a message in a dialog box?(a) alert()(b) prompt()(c) message()(d) console.logThe question was posed to me in homework.Query is from JavaScript in Web Browsers in portion Server-Side and Client-Side Scripting of JavaScript

Answer»

Right option is (a) ALERT()

Explanation: The Window object defines METHODS like alert(), which DISPLAYS a MESSAGE in a dialog box. A prompt message can be displayed on the screen USING alert().

24.

Which property in the Window object is used to refer to a Location object?(a) position(b) area(c) window(d) locationThis question was posed to me by my school principal while I was bunking the class.This key question is from JavaScript in Web Browsers in division Server-Side and Client-Side Scripting of JavaScript

Answer» CORRECT answer is (d) LOCATION

To explain I would say: The Window object defines properties like location, which REFERS to a Location object that specifies the URL currently DISPLAYED in the window and allows a script to LOAD a new URL into the window. The window.location object can be used to get the current page address (URL) and to redirect the browser to a new page.
25.

Which identifier is used to represent a web browser window or frame?(a) frames(b) window(c) location(d) frameThe question was asked in final exam.Asked question is from JavaScript in Web Browsers in section Server-Side and Client-Side Scripting of JavaScript

Answer»

The correct answer is (B) WINDOW

For explanation I WOULD say: The window object represents a WEB browser window or frame, and you can refer to it with the identifier window. Global variables are properties of the window object and Global functions are methods of the window object.

26.

Which object is the main entry point to all client-side JavaScript features and APIs?(a) Standard(b) Location(c) Window(d) PositionI had been asked this question during an interview.My doubt is from JavaScript in Web Browsers in chapter Server-Side and Client-Side Scripting of JavaScript

Answer»

Correct option is (C) Window

To explain: The Window object is the main entry POINT to all client-side JAVASCRIPT FEATURES and APIs. It represents a web browser window or frame, and you can refer to it with the identifier window.

27.

What is the code to start displaying the time when the document loads?(a) onload = displayTime;(b) window. = displayTime;(c) window.onload = displayTime;(d) window.onload = start;This question was posed to me in an interview for job.My doubt is from Embedding JavaScript in HTML topic in section Server-Side and Client-Side Scripting of JavaScript

Answer»

Correct answer is (c) window.onload = displayTime;

The explanation: window.onload is USED to ACCESS the SCREEN while the PAGE is loading. The above code starts displaying the time when the DOCUMENT loads.

28.

What will be done if more than one page requires a file of JavaScript code?(a) Downloads that many times(b) Retrives from the browser cache(c) Must be re executed(d) Must be included in all the pagesThis question was posed to me in an international level competition.This interesting question is from Embedding JavaScript in HTML topic in division Server-Side and Client-Side Scripting of JavaScript

Answer»

Right option is (b) Retrives from the browser cache

Explanation: If a file of JavaScript code is shared by more than one page, it only needs to be DOWNLOADED once, by the first page that uses it—subsequent PAGES can RETRIEVE it from the browser cache. This MAKES the LOADING process easier and hence faster.

29.

The word “document” mainly refers to ______________(a) Dynamic Information(b) Static Information(c) Both Dynamic and Static Information(d) Temporary informationThe question was asked by my college director while I was bunking the class.I would like to ask this question from JavaScript in Web Browsers topic in chapter Server-Side and Client-Side Scripting of JavaScript

Answer»

The CORRECT choice is (B) Static Information

To explain I would say: Some pages present static information and can be called DOCUMENTS. The document is a keyword which is used in selecting any PARTICULAR ELEMENT in the document.

30.

What is the default value of the type attribute?(a) text/css(b) text/javascript(c) html(d) xmlI had been asked this question by my college director while I was bunking the class.This intriguing question originated from Embedding JavaScript in HTML topic in portion Server-Side and Client-Side Scripting of JavaScript

Answer» RIGHT answer is (b) text/javascript

Easy explanation: The default VALUE of the TYPE ATTRIBUTE is “text/javascript”. You can SPECIFY this type explicitly if you want, but it is never necessary.
31.

One of the main advantage of using src attribute is ____________(a) It becomes self-cached(b) It makes the HTML file modular(c) It restricts manipulation in the HTML file(d) It simplifies the HTML filesI got this question by my school principal while I was bunking the class.My question is from Embedding JavaScript in HTML in chapter Server-Side and Client-Side Scripting of JavaScript

Answer»

Right OPTION is (d) It simplifies the HTML files

Explanation: The main advantage of using the src ATTRIBUTE is that it simplifies your HTML files by allowing you to remove LARGE blocks of JavaScript code from them. HENCE separate files for css and javascript files are made to make the code modular and readable.

32.

What is the code for getting the current time?(a) now = new Date();(b) var now = new Date();(c) var now = Date();(d) var now = new Date(current);The question was posed to me by my college director while I was bunking the class.This question is from Embedding JavaScript in HTML topic in portion Server-Side and Client-Side Scripting of JavaScript

Answer»

Correct answer is (b) var now = new Date();

To explain I would SAY: Date() is a predefined FUNCTION in JAVASCRIPT which returns the date in string form. The above CODE determines the current TIME and stores it in the variable “now”.

33.

Which is the root element in a HTML document?(a) HTML(b) HEAD(c) SCRIPT(d) BODYThis question was posed to me during an online interview.I'd like to ask this question from Embedding JavaScript in HTML in portion Server-Side and Client-Side Scripting of JavaScript

Answer»

The correct ANSWER is (a) HTML

For explanation I would SAY: The “html” TAG is the root element of any HTML document regardless of it containing a JavaScript CODE or not. Body tag includes the main CONTENT that is shown on the website.

34.

Which character in JavaScript code will be interpreted as XML markup?(a) !(b) >(c) &(d) .I got this question by my college director while I was bunking the class.Asked question is from Embedding JavaScript in HTML topic in chapter Server-Side and Client-Side Scripting of JavaScript

Answer» RIGHT option is (C) &

To elaborate: If your JAVASCRIPT code contains the < or & characters, these characters are interpreted as XML MARKUP. Element tags must begin with the < character, and entities and character references in an XML document must begin with the & character.
35.

When does JavaScript code appear inline within an HTML file?(a) Between the “script” tag(b) Outside the “script” tag(c) Between or Outside the “script” tag(d) Between the header tagThis question was addressed to me in an online interview.My question is taken from Embedding JavaScript in HTML topic in section Server-Side and Client-Side Scripting of JavaScript

Answer»

Correct option is (a) Between the “SCRIPTTAG

To elaborate: JavaScript code can appear inline within an HTML file between the “script” tags. Javascript can also be included from an external file SPECIFIED by the src ATTRIBUTE of a “script” tag.

36.

Which is the function used to retrieve a value?(a) get()(b) retrieve()(c) getItem()(d) retrieveItem()The question was asked by my college director while I was bunking the class.This interesting question is from Client-Side Storage in section Server-Side and Client-Side Scripting of JavaScript

Answer»

Right choice is (C) getItem()

EASY explanation: To retrieve a value, pass the NAME to getItem(). The getItem() method of the Storage INTERFACE, when passed a key name, will RETURN that key’s value, or null if the key does not exist, in the given Storage object.

37.

Which of the following is a way of embedding Client-side JavaScript code within HTML documents?(a) From javascript:encoding(b) External file specified by the src attribute of a “script” tag(c) By using a header tag(d) By using body tagI got this question during an online interview.I need to ask this question from Embedding JavaScript in HTML topic in portion Server-Side and Client-Side Scripting of JavaScript

Answer»

The CORRECT ANSWER is (b) External file SPECIFIED by the src attribute of a “script” tag

For explanation: The Client-side JavaScript code is EMBEDDED within HTML documents in four WAYS :

Inline, between a pair of “script” tags

From an external file specified by the src attribute of a “script” tag

In an HTML event handler attribute, such as onclick or onmouseover

In a URL that uses the special javascript: protocol.

38.

What is the lifetime of the data stored through localStorage?(a) Permanent(b) Temporary(c) Both Permanent and Temporary at times(d) Cannot storeI had been asked this question during an interview for a job.The query is from Client-Side Storage topic in division Server-Side and Client-Side Scripting of JavaScript

Answer»

Correct ANSWER is (a) Permanent

Easiest explanation: DATA stored through localStorage is permanent. it does not expire and remains stored on the user’s computer until a web APP deletes it or the user asks the browser (through some browser-specific UI) to DELETE it. This data is stored on the client side server and is USED for faster access of data.

39.

What is the main difference between localStorage and sessionStorage?(a) Lifetime(b) Scope(c) Both Lifetime and Scope(d) Storage LocationI have been asked this question in class test.I want to ask this question from Client-Side Storage in chapter Server-Side and Client-Side Scripting of JavaScript

Answer»

The correct option is (c) Both LIFETIME and Scope

Easy explanation: The DIFFERENCE between localStorage and sessionStorage has to do with lifetime and scope: how long the data is SAVED for and who the data is accessible to. SESSION storage is destroyed once the user closes the browser whereas, Local storage stores data with no expiration date.

40.

The localStorage and sessionStorage belongs to ___________(a) Window object(b) Element object(c) Hash object(d) DOM objectI have been asked this question in an internship interview.The query is from Client-Side Storage in section Server-Side and Client-Side Scripting of JavaScript

Answer»

Correct choice is (a) WINDOW object

For EXPLANATION: Browsers that implement the “Web Storage” draft specification define two properties on the Window object: localStorage and SESSIONSTORAGE. Local storage and Session storage are the web storage objects. Session storage is destroyed once the user CLOSES the browser whereas, Local storage stores data with no expiration date.

41.

Which is the most appropriate database for developers requiring a huge amount of data?(a) Database(b) Datawarehouse(c) Web databases(d) AccessI have been asked this question in a job interview.My enquiry is from Client-Side Storage topic in division Server-Side and Client-Side Scripting of JavaScript

Answer»

Correct option is (C) Web databases

To elaborate: Developers who NEED to work with REALLY huge amounts of data like to use databases, and the most recent browsers have started to integrate CLIENT-side database functionality into their browsers. Client data base helps in making the website FASTER and handling the data easier.

42.

Which object supports Filesystem API?(a) Element(b) File(c) Window(d) DOMThe question was posed to me during a job interview.I'd like to ask this question from Client-Side Storage topic in chapter Server-Side and Client-Side Scripting of JavaScript

Answer»

Correct answer is (b) FILE

Easy explanation: These objects can be obtained from the FILESYSTEM property on any file system ENTRY. Some browsers offer additional APIs to create and MANAGE file systems, such as CHROME’s requestFileSystem() method.

43.

Which is Microsoft’s own proprietary client-side storage?(a) IE User Data(b) Offline Web Applications(c) Cookies(d) Offline ApisThis question was addressed to me in my homework.Question is taken from Client-Side Storage in division Server-Side and Client-Side Scripting of JavaScript

Answer»

The correct OPTION is (a) IE USER Data

The explanation is: Microsoft implements its own PROPRIETARY client-side storage MECHANISM, known as “userData,” in IE5 and later. userData enables the storage of medium amounts of string data and can be used as an alternative to Web Storage in versions of IE before IE8. This makes LOADING of programs and software faster.

44.

Which is the storage that allows the caching of web pages and their associated resources?(a) Web Databases(b) FileSystem API(c) Offline Web Applications(d) CookiesThis question was posed to me in a national level competition.I would like to ask this question from Client-Side Storage topic in division Server-Side and Client-Side Scripting of JavaScript

Answer»

The correct answer is (c) Offline WEB Applications

To elaborate: HTML5 DEFINES an “Offline Web Applications” API that allows the caching of web pages and their ASSOCIATED resources (scripts, CSS files, images, and so on). This is client-side storage for web applications themselves rather than just their data, and it allows web apps to install themselves so that they are available even when there is no CONNECTION to the INTERNET.

45.

Which is not a form of client-side storage?(a) Web Databases(b) FileSystem API(c) Offline Web Applications(d) Online Web ApplicationsI got this question in an interview.I need to ask this question from Client-Side Storage in section Server-Side and Client-Side Scripting of JavaScript

Answer»

Right answer is (d) ONLINE Web Applications

To explain: Client-side storage ALLOWS the creater to STORE data on the users system for faster loading of the website. The various FORMS of client-side storage are web databases, filesystem API, OFFLINE web applications and cookies.

46.

Why does Node not block while waiting for operations to complete?(a) Static(b) Asynchronous(c) Synchronous(d) RecursiveThis question was addressed to me in an international level competition.The query is from Asynchronous I/O with Rhino in section Server-Side and Client-Side Scripting of JavaScript

Answer» RIGHT CHOICE is (b) Asynchronous

Easy explanation: NODE executes the function the in one go without any waiting or blocking. Because the Node’s functions and methods are asynchronous, they do not block while waiting for operations to complete.
47.

The necessary globals of a node are defined under which namespace?(a) variables(b) system(c) process(d) usingI have been asked this question in examination.My question comes from Asynchronous I/O with Rhino in chapter Server-Side and Client-Side Scripting of JavaScript

Answer»

Right choice is (c) process

Easiest explanation: The process object is a global that PROVIDES information about, and control over, the current Node.js process. Node DEFINES other important GLOBALS under the process NAMESPACE.

48.

Among the below given functions, Node supports which of the following client-side timer functions?(a) getInterval()(b) Interval()(c) clearTime()(d) clearTimeout()This question was posed to me in an online quiz.My question is from Asynchronous I/O with Rhino in division Server-Side and Client-Side Scripting of JavaScript

Answer»

Correct choice is (d) clearTimeout()

To explain I would say: Client-side timer functions are used to perform APPLICATIONS based on TIME constraints. Node SUPPORTS the client-side timer functions SET setTimeout(), setInterval(), clearTimeout(), andclearInterval().

49.

What is the code to print hello one second from now?(a) setTimeout(function() { console.log(“Hello World”); }, 1000);(b) setTimeout(function() { 1000, console.log(“Hello World”); });(c) setTimeout(function(1000) { console.log(“Hello World”); });(d) setTimeout(function() { console.log(“Hello World”); });I have been asked this question in an online interview.I'm obligated to ask this question of Asynchronous I/O with Rhino in division Server-Side and Client-Side Scripting of JavaScript

Answer»

Right CHOICE is (a) setTimeout(function() { console.log(“Hello WORLD”); }, 1000);

To explain I would say: SetTimeout function is used to hold the execution of the CODE with the required amount of time. The argument of the setTimeout includes the function which is to be executed FOLLOWED by the time after which the code is to be executed.

50.

What is the command used for debugging output in Node?(a) print();(b) console.log(…);(c) debug(…);(d) execute(…);I had been asked this question during an interview for a job.My doubt is from Asynchronous I/O with Rhino topic in chapter Server-Side and Client-Side Scripting of JavaScript

Answer»

The correct ANSWER is (B) console.log(…);

EXPLANATION: Console.log() prints the content in the argument on to the output SCREEN. Node defines console.log() for debugging output like browsers do.