497). What does a Node object represent?
[A]Single node
[B]Set of nodes
[C]Sequence of nodes
[D]Node array
Show Answer
Correct Answer: Single node
Notes:
Answer: a
Explanation: The Node object represents a single node in the document tree. A node can be an element node, an attribute node, a text node, or any other of the node types explained in the Node Types chapter.
498). What does the nodeName of the nodeType Document return?
[A] doctype name
[B]target
[C]#comment
[D]#document
Show Answer
Correct Answer: #document
Notes:
Answer: d
Explanation: The nodeName of the nodeType Document returns #document. If the node is an element node, the nodeName property will return the tag name. If the node is an attribute node, the nodeName property will return the name of the attribute.
499). What is the purpose of the method item()?
[A]Returns node after the specified index
[B]Returns node before the specified index
[C]Returns node at specified index
[D]Returns the node following the specified node
Show Answer
Correct Answer: Returns node at specified index
Notes:
Answer: c
Explanation: The method item() returns the node at the specified index in a node list. The nodes are sorted as they appear in the source code, and the index starts at 0.A Node object’s collection of child nodes is an example of a NodeList object.
500). How can the nodes in the node list be accessed?
[A]Key
[B]Index number
[C] Looping
[D]Value
Show Answer
Correct Answer: Index number
Notes:
Answer: b
Explanation: The nodes in the node list can be accessed through their index number. The nodes are sorted as they appear in the source code, and the index starts at 0.
501). Which of the following is the child(s) of the node type EntityReference?
[A]Element
[B]Text
[C] Both Element and Text
[D]Entity
Show Answer
Correct Answer: Both Element and Text
Notes:
Answer: c
Explanation: The createEntityReference() method creates the specified EntityReference Object. The children of the node type EntityReference are Element, ProcessingInstruction, Comment, Text, CDATASection, EntityReference.
502). Which node type represents the root-node of the DOM tree?
[A]Document
[B]DocumentFragment
[C]DocumentType
[D]Entity
Show Answer
Correct Answer: Document
Notes:
Answer: a
Explanation: Everything inside an html document is classified in the form of different nodes. The node type Document represents the root-node of the DOM tree, the entire document.
503). What is the purpose of the DocumentFragment node type?
[A]To hold a portion of a document
[B]To split the document into fragments
[C]To hold the entire document
[D] To hold the fragments
Show Answer
Correct Answer: To hold a portion of a document
Notes:
Answer: a
Explanation: The DocumentFragment node type represents a “lightweight” Document object that has no parent. It is used as a lightweight version of Document that stores a segment of a document structure comprised of nodes just like a standard document.
504). How many nodetype – named constants are available?
Show Answer
Correct Answer: 12
Notes:
Answer: c
Explanation: DOM nodes can be of various types, such as element nodes and text nodes, and each node has a nodeType property giving its type. There are totally 12 nodetype – named constants available.
505). Which of the following Node types have a node value equal to null?
[A]Document
[B]DocumentFragment
[C]DocumentType
[D]All of the mentioned
Show Answer
Correct Answer: All of the mentioned
Notes:
Answer: d
Explanation: All the three node types namely, Document, DocumentFragment, DocumentType have a node value equal to null. If the node is an element node, the nodeType property will return 1. If the node is an attribute node, the nodeType property will return 2.
506). How many node object properties are there?
Show Answer
Correct Answer: 16
Notes:
Answer: c
Explanation: Node interface is the primary datatype for the entire Document Object Model. The node is used to represent a single XML element in the entire document tree. There are totally 16 node object properties.