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.

What is the parameter of the method Date.parse()?(a) date(b) string(c) datestring(d) stringI have been asked this question in an online quiz.The doubt is from Parsing Values using JavaScript in section Parsing, Benchmarking and Logging of JavaScript

Answer»

The correct answer is (C) datestring

To explain: The parse method is defined as Date.parse(datestring). The parse() method PARSES a date string and returns the NUMBER of milliseconds between the date string.

2.

How can you dispatch a synthetic event object?(a) dispatchEvent()(b) dispatch()(c) dispatch(Event)(d) eventdispatch()I have been asked this question in class test.My enquiry is from JavaScript Benchmarking and Logging with perfLogger topic in division Parsing, Benchmarking and Logging of JavaScript

Answer»

Correct choice is (a) dispatchEvent()

Easy explanation: When you have created and initialized a synthetic event OBJECT, you can dispatch it USING the dispatchEvent() method of EventTarget. The dispatchEvent method throws UNSPECIFIED_EVENT_TYPE_ERR if the event’s TYPE was not specified by initializing the event before the method was called, or if the event’s type is NULL or an empty STRING.

3.

The lexical scooping in JavaScript is based on which of the following?(a) Segments(b) Blocks(c) Functions(d) Entire codeThis question was addressed to me during an interview.Query is from JavaScript Benchmarking and Logging with perfLogger in division Parsing, Benchmarking and Logging of JavaScript

Answer» RIGHT option is (c) FUNCTIONS

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. JavaScript has lexical scoping based on functions but not blocks.
4.

To which of the following object does the print() method belong to?(a) window(b) document(c) hash(d) stringI have been asked this question in an online quiz.My question is from Parsing Values using JavaScript in chapter Parsing, Benchmarking and Logging of JavaScript

Answer»

Right OPTION is (a) window

The BEST EXPLANATION: The method print() belongs to the window object. The print() method opens the Print Dialog Box, which lets the user to select preferred PRINTING options.

5.

What is the purpose of the url json?(a) Belongs to JSON object(b) Reference JSON formatted data(c) Belongs to JSON(d) Compiles json dataThis question was addressed to me during a job interview.The question is from Parsing Values using JavaScript topic in chapter Parsing, Benchmarking and Logging of JavaScript

Answer»

Right choice is (b) Reference JSON formatted data

To elaborate: The URL JSON is ASSUMED to reference a file of JSON-formatted data. The VALUE PASSED to the CALLBACK is the OBJECT obtained by parsing the URL contents with jQuery.parseJSON(). jQuery.getJSON() uses this type. If the type is “json” and the URL or data string contains “=?”, the type is converted to “jsonp”.

6.

Which of the following method loads a new document?(a) location.new()(b) loadnew()(c) location.load()(d) location.assign()This question was addressed to me in an online interview.My question comes from Creating a Shared Configuration File using JavaScript topic in section Parsing, Benchmarking and Logging of JavaScript

Answer»

The CORRECT option is (d) location.assign()

To elaborate: The window.location OBJECT can be written WITHOUT the window prefix.

Some examples are window.location.href returns the href (URL) of the current page

window.location.hostname returns the domain name of the web host.

7.

When does the defineContentAttribute() method return a false?(a) Data stored in different table(b) Data stored in its own table(c) Data is not stored at all(d) Data is not obtainedI had been asked this question in exam.This is a very interesting question from Crafting the Public API topic in portion Parsing, Benchmarking and Logging of JavaScript

Answer»

The CORRECT answer is (B) Data stored in its own table

The best explanation: If your fieldtype is storing data in its own table, and doesn’t have any use for a column within the MAIN content table, you may also set defineContentAttribute() to return false. By DEFAULT, BaseFieldType sets the column to VARCHAR(255), but you can override that with defineContentAttribute().

8.

What is the method used to stop an execution of a method?(a) clearInterval()(b) clearTimeout()(c) both clearInterval() and clearTimeout()(d) clearmethod()I got this question in semester exam.This interesting question is from Creating a Shared Configuration File using JavaScript topic in portion Parsing, Benchmarking and Logging of JavaScript

Answer» CORRECT ANSWER is (c) both clearInterval() and clearTimeout()

Explanation: The clearInterval() method is used to STOP further executions of the function specified in the setInterval() method) The clearTimeout() method is used to stop the EXECUTION of the function specified in the setTimeout() method.
9.

What kind of an exception will be thrown if the string to parse is not valid JSON?(a) SyntaxError(b) ArrayOutOfBoundException(c) Both SyntaxError and ArrayOutOfBoundException(d) Compilation errorI got this question in exam.My question comes from Parsing Values using JavaScript topic in division Parsing, Benchmarking and Logging of JavaScript

Answer»

The correct answer is (a) SYNTAXERROR

The EXPLANATION is: The JSON.parse() METHOD parses a STRING and returns a JavaScript object. The method JSON.parse()THROWS a SyntaxError exception if the string to parse is not valid JSON.

10.

Which of the following JavaScript logging tool is standalone?(a) Blackbird(b) Log Hound(c) jsTracer(d) fvloggerThis question was addressed to me in class test.This interesting question is from Remote Logging in portion Parsing, Benchmarking and Logging of JavaScript

Answer» CORRECT answer is (b) Log HOUND

For EXPLANATION: Log Hound is a tool that was designed for finding frequent patterns from event log DATA sets with the help of a breadth-first frequent itemset mining algorithm. LogHound can be employed for mining frequent line patterns from raw event logs, e.g. Log Hound is a standalone JavaScript logging utility that allows you to log messages during execution of JavaScript code.
11.

How many arguments does the getInputHtml() accept?(a) 1(b) 2(c) 3(d) 4I got this question in homework.My doubt stems from Crafting the Public API in portion Parsing, Benchmarking and Logging of JavaScript

Answer» RIGHT CHOICE is (b) 2

For explanation: The method GETINPUTHTML() returns a fieldtype’s input HTML. The method getInputHtml(0 ACCEPTS two arguments: $name and $value. $name is the name you should assign your HTML input name= attribute, and $value is the field’s current value (EITHER from the DB, or the POST data if there was a validation error).
12.

Which is the method used to process on the input post data before it is saved to the database?(a) prep()(b) settings()(c) defineSettings()(d) prepSettings()I had been asked this question by my college director while I was bunking the class.My query is from Crafting the Public API in chapter Parsing, Benchmarking and Logging of JavaScript

Answer» RIGHT answer is (d) prepSettings()

Easiest EXPLANATION: defineSettings() METHOD returns an array whose keys define the setting names, and values define the parameters (the type of value, etc). If you need to do any PROCESSING on your SETTINGS’ post data before they’re saved to the database’s content table, you can do it with the prepSettings() method.
13.

What does the method defineSettings() return?(a) Array of settings name(b) Array of hash key(c) Array of strings(d) Array of objectsThe question was asked in an online quiz.Asked question is from Crafting the Public API topic in section Parsing, Benchmarking and Logging of JavaScript

Answer»

Correct answer is (a) Array of settings name

For explanation: The defineSettings() method returns an array whose keys DEFINE the setting names, and values define the parameters (the type of value, etc). If you need to do any processing on your settings’ POST DATA before they’re saved to the database’s CONTENT table, you can do it with the prepSettings() method.

14.

What is necessary when we need to create a new field in craft?(a) Type of the input(b) Type of the output(c) Type of the field(d) Type of argumentThis question was addressed to me during an interview for a job.My question is from Crafting the Public API topic in portion Parsing, Benchmarking and Logging of JavaScript

Answer»

Right answer is (C) Type of the field

The EXPLANATION: WHENEVER someone creates a new field in Craft, they must SPECIFY what type of field it is. They are organized into Field Groups for convenience, but Field Groups have very little RELEVANCE anywhere else in the system.

15.

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

Answer»

Right answer is (c) 8

To explain: If the string BEGINS with 0x, then the radix VALUE will be 16. If the string begins with “0”, the radix is 8 (OCTAL). This FEATURE is deprecated.

16.

What is the purpose of the method ActiveXObject()?(a) Used to call automation object(b) Used to reference automation object(c) Used to instantiate automation object(d) Used to call & reference automation objectThe question was posed to me in an international level competition.I would like to ask this question from Parsing Values using JavaScript in portion Parsing, Benchmarking and Logging of JavaScript

Answer»

The correct answer is (c) Used to INSTANTIATE AUTOMATION object

To explain I WOULD SAY: The ActiveXObject.prototype object allows adding properties and methods to the ActiveXObject object that can be used with instances of the ActiveXObject object like any predefined PROPERTY or method. The ActiveXObject() object is used only to instantiate Automation objects, and has no members.

17.

What is the function of the XML parser?(a) Converts XML document to XML DOM object(b) Converts XML DOM object to XML document(c) Converts XML DOM object to a comment(d) Compiles the html documentThe question was asked in unit test.The origin of the question is Parsing Values using JavaScript in chapter Parsing, Benchmarking and Logging of JavaScript

Answer»

The correct choice is (a) Converts XML DOCUMENT to XML DOM OBJECT

To elaborate: An XML PARSER converts an XML document into an XML DOM object – which can then be manipulated with JavaScript. All major browsers have a built-in XML parser to access and MANIPULATE XML.

18.

How many parameters does the API accept?(a) 5(b) 6(c) 7(d) 8I had been asked this question during an interview.Question is taken from Creating a Shared Configuration File using JavaScript in chapter Parsing, Benchmarking and Logging of JavaScript

Answer»

Correct choice is (d) 8

Easiest explanation: PARAMETERS are OPTIONS you can pass with the endpoint (such as specifying the response format or the AMOUNT returned) to influence the response. The API ACCEPTS a total of 8 parameters NAMELY:

url

location

runs

fvonly

private

block

f

k

.

19.

Where does the external process save the result of the test?(a) Normal file(b) Flat file(c) Folder(d) .exe fileThis question was addressed to me in class test.My question is based upon JavaScript Benchmarking and Logging with perfLogger topic in section Parsing, Benchmarking and Logging of JavaScript

Answer»

Right CHOICE is (B) Flat file

Best explanation: A flat file consists of a single table of data. It allows the user to specify data attributes, such as columns and data types table by table, and STORES those attributes separate from applications. The external process, SAY savePerfData should in turn save the RESULTS of the test in a flat file.

20.

What will happen if the fvonly parameter is set to 1?(a) Results got for the first view(b) Can run the repeat view test(c) Running the test again(d) Ending the testI have been asked this question in an interview for job.Enquiry is from Creating a Shared Configuration File using JavaScript in portion Parsing, Benchmarking and Logging of JavaScript

Answer»

Right choice is (a) Results GOT for the first view

For explanation I would say: fvonly is an optional parameter which is set to 1 to skip the REPEAT View test. If you set fvonly to 1, you GET results only for the first view, and do not RUN the repeat view test.

21.

What will be the radix value if the string begins with 0x?(a) 13(b) 14(c) 15(d) 16This question was addressed to me during a job interview.The origin of the question is Parsing Values using JavaScript in chapter Parsing, Benchmarking and Logging of JavaScript

Answer»

The correct CHOICE is (d) 16

To explain I would SAY: If the STRING begins with 0x, then the radix value will be 16. If the string begins with “0”, the radix is 8 (octal). If the string begins with any other value, the radix is 10 (decimal).

22.

Which function is used to start the time logging?(a) startTimeLogging()(b) start()(c) Loggingstart()(d) startLogging()I got this question during an interview for a job.I want to ask this question from JavaScript Benchmarking and Logging with perfLogger in division Parsing, Benchmarking and Logging of JavaScript

Answer»

The correct choice is (a) startTimeLogging()

To explain: The function startTimeLogging() is used to start the time logging. The startTimeLogging() method captures the TIMING DATA for ad HOC, etc for referencing an uncached document.location.

23.

What is the significance of the JavaScript logging library log4javascript?(a) Fully featured(b) Easy to use(c) Fully featured and easy to use(d) Easily accessibleI got this question during an interview.I'm obligated to ask this question of Remote Logging topic in division Parsing, Benchmarking and Logging of JavaScript

Answer»

Correct CHOICE is (c) Fully featured and easy to use

The explanation is: Apache Log4j is a JAVA-BASED logging utility.log4javascript is a fully-featured, easy-to-use JAVASCRIPT logging framework based on the Java logging framework log4j. Its purpose is to provide JavaScript developers with a familiar, ROBUST and flexible logging framework with which to debug JavaScript applications.

24.

Which of the following JavaScript logging tool is also a debugging tool?(a) Blackbird(b) Log Hound(c) jsTracer(d) fvloggerThis question was addressed to me in an interview.I would like to ask this question from Remote Logging in section Parsing, Benchmarking and Logging of JavaScript

Answer»

Correct choice is (C) jsTracer

Easiest explanation: jsTracer is a simple yet feature rich JavaScript logging and debugging tool. It is ESPECIALLY useful for debugging what has been coined “WEB 2.0” code. It HELPS in dynamic tracing for JavaScript, written in JavaScript, PROVIDING you insight into your live nodejs applications, at the process, machine, or cluster level.

25.

Which of the following are JavaScript logging library?(a) log(b) loglevel(c) leveljavascript(d) jslogjavaThis question was posed to me in examination.This interesting question is from Remote Logging in portion Parsing, Benchmarking and Logging of JavaScript

Answer»

Correct choice is (b) LOGLEVEL

The best explanation: loglevel is a JavaScript LOGGING library that is reliable and EXTREMELY easy-to-use over the various console.log() methods. 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.

26.

What is the return type of the method parseInt()?(a) String(b) Float(c) Integer(d) DateI have been asked this question by my school principal while I was bunking the class.My question comes from Parsing Values using JavaScript topic in section Parsing, Benchmarking and Logging of JavaScript

Answer»

Correct ANSWER is (C) Integer

Explanation: The function parseInt() method PARSES a STRING and RETURNS an integer. The method parseInt() returns an integer.

27.

How many default number methods are available in JavaScript?(a) 5(b) 6(c) 7(d) 8This question was addressed to me in an interview for internship.The origin of the question is JavaScript Benchmarking and Logging with perfLogger topic in division Parsing, Benchmarking and Logging of JavaScript

Answer»

Right ANSWER is (C) 7

To ELABORATE: There are a total of 7 default number methods in JAVASCRIPT namely:

constructor()

toExponential()

toFixed()

toLocaleString()

toPrecision()

toString()

valueOf()

28.

Which is the function in JavaScript that will print the current page in JavaScript?(a) print()(b) printcurrent()(c) print(now)(d) print(this)I got this question in an online quiz.My enquiry is from Parsing Values using JavaScript topic in division Parsing, Benchmarking and Logging of JavaScript

Answer»

The correct answer is (a) print()

For EXPLANATION: The print() method PRINTS the contents of the CURRENT window. The print() method opens the Print Dialog Box, which lets the user to select PREFERRED printing options.

29.

What is the necessity to create a separate file after having an API key?(a) To hold configuration information(b) To hold key details(c) To hold URL details(d) To hold the speed of the processI have been asked this question in semester exam.Question is from Creating a Shared Configuration File using JavaScript in chapter Parsing, Benchmarking and Logging of JavaScript

Answer»

The CORRECT option is (a) To hold configuration information

To EXPLAIN: An application PROGRAMMING interface key (API key) is a code passed in by COMPUTER PROGRAMS calling an application programming interface (API) to identify the calling program, its developer, or its user to the Web site. Once you have an API key you should create a separate file to hold all of the configuration information that you will need to share between processes.

30.

What will happen if the radix parameter of the parseInt() function is omitted?(a) Runs in assumption(b) Throws exception(c) Aborts(d) Taken as 0The question was asked during an interview.This is a very interesting question from Parsing Values using JavaScript topic in section Parsing, Benchmarking and Logging of JavaScript

Answer»

Correct ANSWER is (a) Runs in assumption

Easy explanation: The PRINT() method opens the Print Dialog Box, which lets the user to select preferred printing options.

If the string begins with “0x”, the radix is 16 (hexadecimal)

If the string begins with “0”, the radix is 8 (octal). This feature is deprecated

If the string begins with any other value, the radix is 10 (decimal)

31.

How many reserved words are there in JavaScript?(a) 63(b) 54(c) 68(d) 90I have been asked this question in an internship interview.Enquiry is from Creating a Shared Configuration File using JavaScript in section Parsing, Benchmarking and Logging of JavaScript

Answer»

The CORRECT choice is (a) 63

Explanation: Keywords are reserved WORDS in JavaScript which you cannot use to name the variables labels or FUNCTION names. There are a total of 63 reserved words in JavaScript.

32.

Which of the following browsers support the usage of the JavaScript logging library log4javascript?(a) IE(b) Safari(c) Opera(d) All of the mentionedThis question was addressed to me by my school principal while I was bunking the class.Query is from Remote Logging topic in portion Parsing, Benchmarking and Logging of JavaScript

Answer»

The correct choice is (d) All of the mentioned

Easy explanation: Apache LOG4J is a Java-based logging UTILITY. It was originally written by Ceki Gülcü and is part of the Apache Logging Services PROJECT of the Apache Software Foundation. Since a major use of JavaScript logging is in browser testing, log4javascript is tested and works across all recent major browsers, including:

Internet Explorer 5+ for Windows

Mozilla, FIREFOX, Netscape

Google Chrome

Safari 1.3+

Opera 7.5+

WebKit

Konqueror 3.4+

33.

Which function is used to stop the time logging?(a) stopTimeLogging()(b) stop()(c) finish()(d) abort()I got this question in an interview.Question is from JavaScript Benchmarking and Logging with perfLogger in division Parsing, Benchmarking and Logging of JavaScript

Answer»

Right option is (a) stopTimeLogging()

The EXPLANATION: The function stopTimeLogging() is used to stop the time LOGGING. The stopTimeLogging() stops the timing data for ad hoc, ETC for REFERENCING an uncached document.location.

34.

What is the observer effect?(a) Observing influences outcome(b) Observing never influences outcome(c) Observing and the outcome are independent(d) Observing and the outcome are not relatedThis question was addressed to me during a job interview.This intriguing question originated from JavaScript Benchmarking and Logging with perfLogger topic in chapter Parsing, Benchmarking and Logging of JavaScript

Answer»

The correct answer is (a) OBSERVING influences outcome

The best I can EXPLAIN: The observer EFFECT says that SIMPLY observing an act influences its outcome. This is often the result of instruments that, by necessity, ALTER the state of what they measure in some manner.

35.

What is the purpose of the window.location object in JavaScript?(a) Get the URL and redirect(b) Get the location of the cursor(c) Get the path to the next page(d) Get the location & path of the next pageThis question was posed to me during an interview.I need to ask this question from Creating a Shared Configuration File using JavaScript in chapter Parsing, Benchmarking and Logging of JavaScript

Answer»

The correct choice is (a) Get the URL and redirect

Explanation: The window.location OBJECT can be used to get the current page address (URL) and to redirect the browser to a new page. The PARAMETER location specifies the agent location, SPEED and browser to use for the TEST, formatted as location.browser:location.

36.

What is the purpose of the adoptNode() method?(a) Removes node(b) Makes it ready for insertion(c) Removes node and Makes it ready for insertion(d) Changes the nodeThis question was posed to me in an online quiz.This interesting question is from JavaScript Benchmarking and Logging with perfLogger in portion Parsing, Benchmarking and Logging of JavaScript

Answer»

The CORRECT answer is (c) Removes node and Makes it READY for INSERTION

Best explanation: This METHOD removes the node from whatever document it is currently part of and changes its ownerDocument property to this document, making it ready for insertion into this document. The ADOPTNODE() method adopts a node from another document. The adopted node can be of all node types.

37.

How many events does the BaseFieldType provide?(a) 1(b) 2(c) 3(d) 4The question was asked by my college director while I was bunking the class.This intriguing question comes from Crafting the Public API topic in division Parsing, Benchmarking and Logging of JavaScript

Answer»

The correct answer is (c) 3

Explanation: BaseFieldType provides three events that you can LATCH code ONTO:

onBeforeSave() : CALLED RIGHT before a field is saved.

onAfterSave() : Called right after a field is saved, and $this->model->id is set.

onAfterElementSave() : Called right after an element is saved, and $this->element->id is set.

38.

What is the return data type of the property accept that belongs to the Input element?(a) integer(b) string(c) boolean(d) floatThe question was asked during an interview for a job.Question is from JavaScript Benchmarking and Logging with perfLogger topic in section Parsing, Benchmarking and Logging of JavaScript

Answer»

Correct ANSWER is (b) string

To ELABORATE: The ACCEPT attribute is used to define the types of files that the control can select. When type is “FILE”, this property is a comma-separated list of MIME types that specify the types of files that may be SELECTED. The strings “audio/*”, “video/*”, and “image/*” are also legal.

39.

How can you create a node for comment in JavaScript?(a) comment()(b) createComment()(c) comm()(d) create()I got this question at a job interview.Query is from JavaScript Benchmarking and Logging with perfLogger topic in section Parsing, Benchmarking and Logging of JavaScript

Answer»

Right answer is (b) createComment()

For explanation: The COMMENT node can be created using the method Comment createComment(STRING data). The createComment() method CREATES a Comment node with the SPECIFIED TEXT.

40.

Which of the following is a JavaScript Compressor?(a) Esprima(b) UgilifyJS(c) Acron(d) CompressifyThis question was posed to me during an interview for a job.The above asked question is from Parsing Values using JavaScript topic in division Parsing, Benchmarking and Logging of JavaScript

Answer»

Right choice is (b) UgilifyJS

Explanation: UgilifyJS is a JavaScript compressor/minifier written in JavaScript. It ALSO contains TOOLS that ALLOW one to automate WORKING with JavaScript code.

41.

What is the purpose of the radix parameter in the parseInt() method?(a) Numeral system not to be used(b) Numeral system to be used(c) Conversion mode(d) Parsing modeI got this question during an interview.I need to ask this question from Parsing Values using JavaScript in portion Parsing, Benchmarking and Logging of JavaScript

Answer»

The correct choice is (b) NUMERAL system to be used

Explanation: FUNCTION parseInt() method parses a string and returns an INTEGER. The radix PARAMETER is used to specify which numeral system to be used, for example, a radix of 16 (hexadecimal) indicates that the NUMBER in the string should be parsed from a hexadecimal number to a decimal number.

42.

What is the function of the parseInt() method?(a) Parses a data type and stores in an integer(b) Parses a string and returns an integer(c) Parses an integer and returns a string(d) Parses a string and return an objectThis question was posed to me in semester exam.I want to ask this question from Parsing Values using JavaScript in division Parsing, Benchmarking and Logging of JavaScript

Answer»

The correct option is (B) Parses a string and returns an INTEGER

Easiest explanation: The function parseInt() method parses a string and returns an integer. If the string begins with 0x, then the radix value will be 16. If the string begins with “0”, the radix is 8 (octal).

43.

What does the getInputHtml() return?(a) Input(b) Fieldtype’s input HTML(c) Array(d) ValueI got this question during an interview.I'd like to ask this question from Crafting the Public API topic in division Parsing, Benchmarking and Logging of JavaScript

Answer»

The correct choice is (b) Fieldtype’s input HTML

Easy explanation: The method GETINPUTHTML() returns a fieldtype’s input HTML. It accepts two ARGUMENTS: $NAME and $value.

44.

What is the purpose of the UgilifyJS?(a) Exposes a simple API(b) Minification(c) Both Exposes a simple API and Minification(d) CompilationThe question was posed to me in semester exam.This interesting question is from Parsing Values using JavaScript topic in chapter Parsing, Benchmarking and Logging of JavaScript

Answer»

Right option is (c) Both EXPOSES a simple API and Minification

To explain I would say: UglifyJS is a JavaScript compressor/minifier WRITTEN in JavaScript. UglifyJS2 is an EXCELLENT tool to help you minify your JavaScript! It’s a tried and tested tool, USED by LIBRARIES such as jQuery.

45.

What are the parameters of the method JSON.parse()?(a) text(b) reviver(c) both text and reviver(d) objectI have been asked this question in semester exam.Enquiry is from Parsing Values using JavaScript topic in section Parsing, Benchmarking and Logging of JavaScript

Answer» RIGHT answer is (c) both text and reviver

To EXPLAIN: The JSON.parse() method can optionally transform the result with a function. The parameters of the method JSON.parse() are :

text : The string to parse as JSON.

reviver : If a function, prescribes how the VALUE originally PRODUCED by parsing is transformed, before being returned.
46.

Which of the following method will wait for certain milliseconds to execute a specified method?(a) setInterval()(b) setTimeout()(c) setmilli()(d) setseconds()I got this question in exam.Enquiry is from Creating a Shared Configuration File using JavaScript in division Parsing, Benchmarking and Logging of JavaScript

Answer» RIGHT option is (a) setInterval()

The EXPLANATION is: The setInterval() method CALLS a function or evaluates an EXPRESSION at specified intervals (in MILLISECONDS). The setInterval() method will wait a specified number of milliseconds, and then execute a specified function, and it will continue to execute the function, once at every given time-interval.
47.

What is the purpose of the parameter $value?(a) Field’s expected value(b) Field’s previous value(c) Field’s current value(d) Field’s probability valueThe question was asked during a job interview.The above asked question is from Crafting the Public API in chapter Parsing, Benchmarking and Logging of JavaScript

Answer»

Right option is (C) Field’s current value

Easy explanation: getinputhtml() accepts two arguments: $NAME and $value. The PARAMETER $value is the field’s current value (either from the DB, or the POST data if there was a VALIDATION error).

48.

What is not the purpose of the parameter location?(a) Specifies agent location(b) Specifies speed(c) Specifies browser(d) Specifies blockI have been asked this question in an internship interview.My question comes from Creating a Shared Configuration File using JavaScript in chapter Parsing, Benchmarking and Logging of JavaScript

Answer»

The correct choice is (d) Specifies block

Best explanation: The window.LOCATION object can be used to get the current page address (URL) and to redirect the browser to a new page. The parameter location specifies the AGENT location, SPEED and browser to USE for the test, formatted as location.browser:location.

49.

What is the purpose of the property width belonging to the ImageData element?(a) Number of data(b) Number of pixels(c) Number of pixels per row of data(d) Number of columnsThis question was addressed to me in exam.I want to ask this question from JavaScript Benchmarking and Logging with perfLogger topic in chapter Parsing, Benchmarking and Logging of JavaScript

Answer»

Correct choice is (c) Number of pixels per ROW of data

To elaborate: Image data element indicates the INTRINSIC WIDTH of the image, in CSS pixels. The width property is used to retrieve or STORE the number of pixels per row of data.

50.

Which of the following reads the textual contents of a URL and returns as a string?(a) spawn(f);(b) load(filename,…);(c) readFile(file);(d) readUrl(url);This question was addressed to me at a job interview.Query is from Remote Logging topic in chapter Parsing, Benchmarking and Logging of JavaScript

Answer»

The correct choice is (d) readUrl(url);

The BEST explanation: readUrl() opens an INPUT CONNECTION to the given string url, read all its bytes and convert them to a string using the SPECIFIED character coding or default character coding if an explicit coding ARGUMENT is not given.