1066). Which of the following is not a JavaScript framework?
[A]Rico
[B]Prototype
[C]Joco
[D]DoJo
Show Answer
Correct Answer: DoJo
Notes:
Answer: d
Explanation: Dojo Toolkit is an open source modular JavaScript library (or more specifically JavaScript toolkit) designed to ease the rapid development of cross-platform, JavaScript/Ajax-based applications and web sites. Rico was an open-source JavaScript library for developing rich internet applications with Ajax.
1067). What is the purpose of the Math method toSource()?
[A]Returns the string “Math”
[B] Sends the source to the Math Library
[C]Returns the value of the object
[D]Returns an integer value
Show Answer
Correct Answer: Returns the string “Math”
Notes:
Answer: a
Explanation: The method Math.toSource() returns the string “Math”. But this method does not work with many browsers like IE. The toSource() method returns a string representing the source code of the object.
1068). What will be the output of the following JavaScript code?
var o = new F();
o.constructor === F
[A]false
[B]true
[C]0
[D]1
Show Answer
Correct Answer: true
Notes:
Answer: b
Explanation: ’===’ sign is used for comparing the type of values. The result is true if the constructor property specifies the class.
1069). How many static methods does a Date object have?
var o = new F();
o.constructor === F
Show Answer
Correct Answer: 2
Notes:
Answer: d
Explanation: Date objects are created with the new Date() constructor. The Date object defines two static methods namely Date.parse() and Date.UTC().
1070). Which of the following are static methods in JavaScript?
var o = new F();
o.constructor === F
[A]Date.parse()
[B]Date.UTC()
[C]Both Date.parse() and Date.UTC()
[D]Date.clear()
Show Answer
Correct Answer: Both Date.parse() and Date.UTC()
Notes:
Answer: c
Explanation: Date objects are created with the new Date() constructor. Date.parse() parses a string representation of a date and time and returns the internal millisecond representation of that date. Date.UTC() Returns the millisecond representation of the specified UTC date and time.
1071). What will be the work of the getAvg in the following JavaScript function?
Show Answer Correct Answer: Find the average of 199 numbers
Notes:
Answer: d
Explanation: For loop is used in the above code for adding the numbers. The above code performs the average calculation of numbers from 0 to 199.
1072). If we have an object r and want to know if it is a Range object, we can write ______________
Show Answer Correct Answer: r instanceof Range
Notes:
Answer: d
Explanation: To know the range object r instanceof range is used. The r instanceof Range returns true if r inherits from Range.prototype. The instanceof operator does not actually check whether r was initialized by the Range constructor.
1073). What is the property to access the first child of a node?
Show Answer Correct Answer: timestamp.firstChild
Notes:
Answer: d
Explanation: The firstChild property returns the first child node of the specified node, as a Node object. The first child of a node can be accessed using the firstChild property.
1074). Which of the following is not an object?
Show Answer Correct Answer: Position
Notes:
Answer: c
Explanation: The window object represents an open window in a browser. There is no object called Position.
1075). What is the code snippet to change the class and let the stylesheet specify the details?
Show Answer Correct Answer: timestamp.className = “highlight”;
Notes:
Answer: a
Explanation: “typename” is a keyword in the C++ programming language used when writing templates. The above code snippet changes the class and lets the stylesheet specify the details.