792). 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 mode
Show Answer
Correct Answer: Numeral system to be used
Notes:
Answer: b
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.
793). What will be the radix value of the parseInt() method when the string begins with 0?
Show Answer
Correct Answer: 8
Notes:
Answer: c
Explanation: 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.
794). 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 string
Show Answer
Correct Answer: Parses a string to JSON
Notes:
Answer: b
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.
795). What is the return type of the method parseInt()?
[A]String
[B]Float
[C]Integer
[D]Date
Show Answer
Correct Answer: Integer
Notes:
Answer: c
Explanation: The function parseInt() method parses a string and returns an integer. The method parseInt() returns an integer.
796). What are the parameters of the method JSON.parse()?
[A]text
[B]reviver
[C]both text and reviver
[D]object
Show Answer
Correct Answer: both text and reviver
Notes:
Answer: c
Explanation: 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.
797). What will be the radix value of the parseInt() method when the string begins with any other value other than 0x and 0?
Show Answer
Correct Answer: 10
Notes:
Answer: c
Explanation: 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.
798). 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 error
Show Answer
Correct Answer: SyntaxError
Notes:
Answer: a
Explanation: 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.
799). Which of the following is a JavaScript Compressor?
[A]Esprima
[B]UgilifyJS
[C]Acron
[D]Compressify
Show Answer
Correct Answer: UgilifyJS
Notes:
Answer: b
Explanation: UgilifyJS is a JavaScript compressor/minifier written in JavaScript. It also contains tools that allow one to automate working with JavaScript code.
800). What is the purpose of the UgilifyJS?
[A]Exposes a simple API
[B]Minification
[C]Both Exposes a simple API and Minification
[D]Compilation
Show Answer
Correct Answer: Both Exposes a simple API and Minification
Notes:
Answer: c
Explanation: 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.
801). Which of the following is the fastest JavaScript parser?
[A]JSLint
[B]Esprima
[C]Acron
[D]Traceur
Show Answer
Correct Answer: Acron
Notes:
Answer: c
Explanation: Acorn is a JavaScript parser written in JavaScript. : Acron is the fastest JavaScript parser written in JavaScript which takes only 96.9ms when compared to all the JavaScript parsers available. Acron is the fastest JavaScript parser written in JavaScript which takes only 96.9ms when compared to all the JavaScript parsers available.