487). How many node types are there in total?
Show Answer
Correct Answer: 12
Notes:
Answer: b
Explanation: There are total of 12 node types. The nodeType property returns the node type, as a number, of the specified node.
488). What is the purpose of the Node object property ownerDocument?
[A]Returns the root element
[B]Returns the last element
[C] Returns the parent node
[D]Returns the immediate node
Show Answer
Correct Answer: Returns the root element
Notes:
Answer: a
Explanation: The ownerDocument property returns the owner document of a node, as a Document object. It returns the root element for a node.
489). Which of the following Node object property returns the local part of the name of a node?
[A]lastName
[B]localName
[C]firstName
[D]objectname
Show Answer
Correct Answer: localName
Notes:
Answer: b
Explanation: The Node object property localName Returns the local part of the name of a node. If the selected node is not an element or attribute, this property returns NULL.
490). What is the property textContent?
[A]Sets the textual content of a node
[B]Returns the textual content of a node
[C]Sets & Returns the textual content of a node
[D]Modifies texual content
Show Answer
Correct Answer: Sets & Returns the textual content of a node
Notes:
Answer: c
Explanation: The property textContent sets or returns the textual content of a node and its descendants. If you set the textContent property, any child nodes are removed and replaced by a single Text node containing the specified string.
491). How many Node object methods are available?
Show Answer
Correct Answer: 18
Notes:
Answer: a
Explanation: The Node object represents a single node in the document tree. There are totally 18 node object methods.
492). Which of the following Node object property returns the node immediately before a node?
[A]previousSibling
[B]textContent
[C]index
[D]localName
Show Answer
Correct Answer: previousSibling
Notes:
Answer: a
Explanation: The node object property previousSibling returns the node immediately before a node. The returned node is returned as a Node object.
493). What is the purpose of the method getUserData(key)?
[A] Returns the associated object
[B]Gets the user data
[C]Returns the user data
[D]Gets the user key
Show Answer
Correct Answer: Returns the associated object
Notes:
Answer: a
Explanation: The method getUserData(key) returns the object associated to a key on a this node. The object must first have been set to this node by calling setUserData with the same key.
494). How to test if two nodes are equal?
[A]isEqualNode()
[B]equal()
[C]==
[D] equalto()
Show Answer
Correct Answer: isEqualNode()
Notes:
Answer: a
Explanation: The method isEqualNode() is used to test if two nodes are equal. Two nodes are equal when they have the same type, defining characteristics (for elements, this would be their ID, number of children, and so forth), its attributes match, and so on.
495). How to associate an object to a key on a node?
[A] getUserData()
[B]cloneNode()
[C]setUserData(key,data,handler)
[D]clonedata()
Show Answer
Correct Answer: setUserData(key,data,handler)
Notes:
Answer: c
Explanation: The Node.setUserData() method allows a user to attach (or remove) data to an element, without needing to modify the DOM. This method is used to associate an object to a key on a node.
496). Which method is used to compare the placement of two nodes in the DOM hierarchy (document)?
[A] compareDocumentPosition()
[B] cloneNode()
[C]getUserData()
[D]getFeature()
Show Answer
Correct Answer: compareDocumentPosition()
Notes:
Answer: a
Explanation: The compareDocumentPosition() method is used to compare the placement of two nodes in the DOM hierarchy (document). The return value is an integer value whose bits represent the calling Node’s relationship to otherNode within the Document.