DSA Finals Flashcards
(72 cards)
What is a tree data structure defined as?
a) A linear data structure with nodes connected sequentially.
b) A recursive data structure with one root node and remaining nodes as children.
c) A data structure where every node can have multiple parents.
d) A collection of disconnected nodes.
A recursive data structure with one root node and remaining nodes as children.
In a tree, what are the nodes other than the root node partitioned into?
a) Parent nodes
b) Sibling sets
c) Non-empty sets, each called a sub-tree.
d) Leaf nodes only.
Non-empty sets, each called a sub-tree.
What relationship can nodes in a tree maintain?
a) Only parent-child relationships.
b) Only sister node relationships.
c) Parent-child relationships or sister node relationships.
d) Grandparent-grandchild relationships exclusively.
Parent-child relationships or sister node relationships.
What relationship can nodes in a tree maintain?
a) Only parent-child relationships.
b) Only sister node relationships.
c) Parent-child relationships or sister node relationships.
d) Grandparent-grandchild relationships exclusively.
Parent-child relationships or sister node relationships.
In a general tree, how many parents can a node have?
a) Any number of parents.
b) Only a single parent.
c) At most two parents.
d) Zero parents if it’s not a root node.
Only a single parent.
Which node is designated as the topmost node in the tree hierarchy?
a) Leaf Node
b) Parent Node
c) Root Node
d) Sibling Node
Root Node
A node that doesn’t have any parent is called the:
a) Child Node
b) Leaf Node
c) Root Node
d) Internal Node
Root Node
If the root node is not null, T1, T2, and T3 connected to the root are called:
a) Parent nodes
b) Sub-trees
c) Sibling nodes
d) Forests
Sub-trees
What is a leaf node?
a) A node with only one child.
b) A node that doesn’t have any child node.
c) The root node of a sub-tree.
d) Any node that is not the root.
A node that doesn’t have any child node.
Leaf nodes can also be called:
a) Internal nodes
b) Parent nodes
c) External nodes
d) Root nodes
External nodes
What is a path in a tree?
a) Any collection of nodes.
b) A single edge connecting two nodes.
c) The sequence of consecutive edges.
d) All nodes at the same level.
The sequence of consecutive edges.
An ancestor of a node is:
a) Any child node of that node.
b) Any sibling node of that node.
c) Any predecessor node on a path from the root to that node.
d) Only the immediate parent of that node.
Any predecessor node on a path from the root to that node.
Which node in a tree doesn’t have any ancestors?
a) Leaf node
b) Root node
c) Any internal node
d) A node with the highest degree
Root node
The degree of a node is equal to:
a) The number of parents it has.
b) The number of children it has.
c) The number of siblings it has.
d) Its level number.
The number of children it has.
What is the degree of a leaf node?
a) 0
b) 1
c) 2
d) Depends on the tree type.
0
The root node of a tree is always present at which level?
a) Level 1
b) Level -1
c) Level 0
d) The maximum level of the tree.
Level 0
In a general tree, nodes present on the same level are called:
a) Ancestors
b) Descendants
c) Siblings
d) Sub-trees
Siblings
A tree in which each node contains 3 sub-trees is called a:
a) Binary tree
b) General tree
c) Ternary tree
d) Complete tree
Ternary tree
How is a forest defined?
a) A single tree with many branches.
b) A tree where every node is a leaf node.
c) The set of disjoint trees obtained by deleting the root node and its connecting edges.
d) A collection of nodes without any edges.
The set of disjoint trees obtained by deleting the root node and its connecting edges.
A binary tree is a data structure in which each node can have at most how many children?
a) 1
b) 2
c) 3
d) Any number
2
Which of the following is NOT a disjoint subset a binary tree is generally partitioned into?
a) The root of the node.
b) Left sub-tree.
c) Right sub-tree.
d) Parent sub-tree.
Parent sub-tree.
In a Strictly Binary Tree, what is true about every non-leaf node?
a) It contains at least one child.
b) It contains non-empty left and right sub-trees.
c) It has a degree of 0.
d) It must be at level 0.
It contains non-empty left and right sub-trees.
What is the degree of every non-leaf node in a Strictly Binary Tree?
a) 0
b) 1
c) 2
d) It varies.
2
A strictly binary tree with ‘n’ leaves will have how many nodes?
a) n
b) 2n
c) 2n - 1
d) n - 1
2n - 1