Explore 100's Of Free Video Tutorials

Keep Learning, Keep Coding & Keep Sharing

CSS

DOM Tree Terminologies

Notes:

DOM Tree Terminologies:
W.K.T. For every HTML code we can draw a Document Object Model tree (DOM tree).
DOM tree is drawn based on the parent and child relationship present between html elements.

A tree is a finite set of nodes.
Nodes in the tree are represented by oval shape.
Nodes are connected with one another by straight lines known as edges.

First node or top most node in the tree is known as root node.
A node containing single child or multiple children is known as parent node.
A node containing no children is known as leaf node.

Ancestors of a node are any node visited in the path from the selected node to the root node.
(i.e. Parent, Grandparent, Grand grandparent, any node visited up to the root node are considered as Ancestors)

Descendants of a node are any node falling under the selected node tree.
(i.e. Direct Children, Children’s Children, or any node that can be reachable from the selected node up to the leaf node is considered as descendant node)

Two or more nodes with same parent are known as siblings (i.e. brothers)

Interview Questions:

1. DOM stands for _________________
a. Data Object Model
b. Document Object Model
c. Datatype Object Model
d. Document Oriented Model
Answer: b

2. Node in the tree is represented by ______________ symbol?
a. Straight line
b. Oval shape
c. Circle shape
d. Rectangle Shape
Answer: b

3. Last nodes in the tree are called as ______________?
a. root node
b. leaf nodes
c. sibling nodes
d. intermediate nodes
Answer: b

4. First node in the tree is called as ______________?
a. leaf node
b. child node
c. successor node
d. root node
Answer: d

5. Two or more nodes having the same parent are called as ______?
a. ancestors
b. parents
c. siblings
d. branches
Answer: c

6. A node having one or more child nodes is called as __________?
a. ancestor
b. parent
c. sibling
d. branch
Answer: b