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.

51.

Which of the following is not an appenders?(a) DummyAppender(b) ConsoleAppender(c) FileAppender(d) DeleteAppenderI had been asked this question at a job interview.I'd like to ask this question from Remote Logging in division Parsing, Benchmarking and Logging of JavaScript

Answer»

Right answer is (d) DeleteAppender

The best explanation: There are SEVERAL ways to log using “appender”s. Some of the current available Appenders are:

DummyAppender: log nothing.

ConsoleAppender: open a new window in the browser or an inline div element and insert log messages in real time.

WindowsEventAppender: send log messages in the MS Windows event manager (Internet Explorer only).

FILEAPPENDER: write log messages in a local FILE on the client (IE and Mozilla).

AjaxAppender: allow to send log messages to a remote server with asynchronous HTTP request.

MetatagAppender: add log messages as meta data.

JavaScript CONSOLE Appenders for Opera, Mozilla and Safari.

52.

According to the workflow of a runtime logging, what happens after calculating the run time?(a) Display to screen(b) Log to server(c) Either Display to screen or Log to server(d) Server to logI had been asked this question in class test.I want to ask this question from JavaScript Benchmarking and Logging with perfLogger topic in section Parsing, Benchmarking and Logging of JavaScript

Answer»

The correct answer is (C) Either Display to screen or Log to server

Best explanation: According to the workflow of a runtime logging, after calculating the run time, decision BOXES are KEPT that will check to either display to the DEBUG screen or log to the server.

53.

What will be the radix value of the parseInt()method when the string begins with any other value other than 0x and 0?(a) 8(b) 9(c) 10(d) 11The question was asked during an internship interview.My enquiry is from Parsing Values using JavaScript topic in portion Parsing, Benchmarking and Logging of JavaScript

Answer»

Right option is (c) 10

To elaborate: The radix value will be 10 when the STRING of the method parseInt() begins with any other value other than 0X and 0. If the string begins with 0x, then the radix value will be 16.

54.

What is the purpose of the parameter $name ?(a) Document Name(b) Input Name(c) Output Name(d) IDThe question was asked by my college director while I was bunking the class.The doubt is from Crafting the Public API in chapter Parsing, Benchmarking and Logging of JavaScript

Answer»

The correct answer is (B) Input Name

The best I can explain: getinputhtml() accepts two arguments: $name and $VALUE. The parameter $name is the name you should assign your HTML input name= attribute.

55.

How to calculate the run time of a code?(a) Start time – End time(b) End time – Start time(c) Start time/ End time(d) Start time * End timeI had been asked this question in an interview.I'm obligated to ask this question of JavaScript Benchmarking and Logging with perfLogger in chapter Parsing, Benchmarking and Logging of JavaScript

Answer»

Right choice is (b) END TIME – Start time

The best I can explain: Run-time statements use the static resources created by compile-time statements, but can also create, use, and destroy dynamic resources at run time. The run time of code can be CALCULATED as:

run time = end time – start time

56.

What is the function of the method importNode()?(a) Copies without removing(b) Copies and removes(c) Only copies(d) Only removesThe question was posed to me in final exam.I want to ask this question from JavaScript Benchmarking and Logging with perfLogger in portion Parsing, Benchmarking and Logging of JavaScript

Answer»

Correct OPTION is (a) COPIES without REMOVING

The explanation is: The importNode() method imports a node from ANOTHER document. The imported node can be of all node types. The method importNode() copies a node from another document without removing it.

57.

Which of the following are ways to benchmark code?(a) Timing the code(b) Calculating the number of operations performed(c) Timing the code & Calculating the number of operations performed(d) Calculating the number of linesI got this question in an interview for internship.This is a very interesting question from JavaScript Benchmarking and Logging with perfLogger topic in division Parsing, Benchmarking and Logging of JavaScript

Answer»

Right choice is (c) Timing the code & CALCULATING the NUMBER of OPERATIONS performed

The explanation is: There are a couple of ways to benchmark code—either by timing it or by calculating the number of operations performed during execution. Both of them help in calculating how EFFICIENT and modular the code.

58.

Which of the following JavaScript logging framework lets one to toggle the plane?(a) Lumberjack(b) Log Hound(c) jsTracer(d) fvloggerI had been asked this question in class test.The origin of the question is Remote Logging topic in chapter Parsing, Benchmarking and Logging of JavaScript

Answer»

Right option is (a) Lumberjack

Explanation: Lumberjack is a JavaScript utility that HIJACKS the BROWSER console, makes it more beautiful and ENHANCES it so logs can be split into more manageable chunks. Lumberjack also saves everything that is logged (so you can REVIEW later) and colorizes your logs (where supported) to increase LEGIBILITY.

59.

What is the significance of the JavaScript logging library loglevel?(a) Lightweight(b) Unreliable(c) Minimal usage(d) InconvenientThe question was posed to me by my school principal while I was bunking the class.The above asked question is from Remote Logging in section Parsing, Benchmarking and Logging of JavaScript

Answer»

Correct option is (a) Lightweight

To explain: loglevel is a lightweight, minimal and convenient JavaScript logging library which provides a reliable and extremely easy-to-use layer over the various console.log() methods that are often AVAILABLE, with none of their DOWNSIDES. loglevel MAKES these methods safe to use by GRACEFULLY handling the cases where they don’t exist and also lets you FILTER the output of these, to only show messages at warn level or above.

60.

Which of the following object is used to post the data to an external process, say savePerfData?(a) XML(b) XBT(c) XHR(d) XTRI got this question at a job interview.The above asked question is from JavaScript Benchmarking and Logging with perfLogger in chapter Parsing, Benchmarking and Logging of JavaScript

Answer»

Right OPTION is (c) XHR

The best I can explain: XHR(XMLHttpRequest) is an API in the form of an object whose methods transfer DATA between a WEB browser and a web server. The benchmarking process will call the external process. We use XHR object to POST the data to the external process.

61.

What type of scope is present in JavaScript?(a) Lexical(b) Literal(c) Both Lexical and Literal(d) LocalI had been asked this question during an interview for a job.This key question is from JavaScript Benchmarking and Logging with perfLogger topic in chapter Parsing, Benchmarking and Logging of JavaScript

Answer»

Right ANSWER is (a) Lexical

To explain: Lexical SCOPING (sometimes known as static scoping) is a convention used with many programming languages that sets the SCOPE (RANGE of functionality) of a variable so that it may only be called (referenced) from within the block of code in which it is defined.

62.

What is the purpose of the method JSON.parse()?(a) Parses a string to integer(b) Parses a string to JSON(c) Parses a string from JSON to JSON2(d) Parses integer to stringI have been asked this question in an interview for job.I'd like to ask this question from Parsing Values using JavaScript in section Parsing, Benchmarking and Logging of JavaScript

Answer» CORRECT ANSWER is (b) Parses a string to JSON

Best explanation: The JSON.parse() method parses a string as JSON, optionally transforming the VALUE PRODUCED by parsing. The function parseInt() method parses a string and returns an INTEGER.