# HackerRank Trees Quiz-1

Question 1

Time: 00:00:00
List the reasons for using trees?

Hierarchical approach

Hierarchical approach

No upper limit

No upper limit

Quick search and access

Quick search and access

All

All

Once you attempt the question then PrepInsta explanation will be displayed.

Start

Question 2

Time: 00:00:00
Which is true among the following?

All the children of a node along with all the descendants of the children of a node are known as descendants.

All the children of a node along with all the descendants of the children of a node are known as descendants.

All the children of a node along with all the parents of a node are known as descendants.

All the children of a node along with all the parents of a node are known as descendants.

A leaf node has no descendants

A leaf node has no descendants

a and c

a and c

Once you attempt the question then PrepInsta explanation will be displayed.

Start

Question 3

Time: 00:00:00
We can define the degree of a node as:-

number of  its edges.

number of  its edges.

number of its parent trees.

number of its parent trees.

number of its sub trees.

number of its sub trees.

a and b

a and b

Once you attempt the question then PrepInsta explanation will be displayed.

Start

Question 4

Time: 00:00:00
Statement 1: The depth of tree starts from 0

Statement 2:the level of tree starts from 1

Statement 1 is true and Statement 2 is false

Statement 1 is true and Statement 2 is false

Statement 1 is false and Statement 2 is true

Statement 1 is false and Statement 2 is true

Both are true

Both are true

Both are false

Both are false

Once you attempt the question then PrepInsta explanation will be displayed.

Start

Question 5

Time: 00:00:00
A Perfect Binary Tree of height h has:

(2h+1 – 1)nodes   (if h starts from 0)

(2h+1 – 1)nodes   (if h starts from 0)

(2h – 1)nodes  (if h starts from 1)

(2h – 1)nodes  (if h starts from 1)

(2h + 1)nodes  (if h starts from 1)

(2h + 1)nodes  (if h starts from 1)

a and b

a and b

Once you attempt the question then PrepInsta explanation will be displayed.

Start

Question 6

Time: 00:00:00
In AVL trees, the values of correct balance factor is/are:

1,0

1,0

0,-1

0,-1

1,0,-1

1,0,-1

Only 1

Only 1

Once you attempt the question then PrepInsta explanation will be displayed.

Start

Question 7

Time: 00:00:00
The inorder and preorder traversal of a tree is:- H D I B E A F J C K G L and A B D H I E C F J G K L

Find the postorder traversal.

HIDBEJFKLGCA

HIDBEJFKLGCA

HIDEBKFJLGCA

HIDEBKFJLGCA

HIDEBJFKLGCA

HIDEBJFKLGCA

HIDEBJFKGCAB

HIDEBJFKGCAB

Once you attempt the question then PrepInsta explanation will be displayed.

Start

Question 8

Time: 00:00:00
The balance factor of an AVL tree can be calculated by:-

Subtracting the height of the right subtree from the height of the left subtree

Subtracting the height of the right subtree from the height of the left subtree

Subtracting the height of the left subtree from the height of the right subtree

Subtracting the height of the left subtree from the height of the right subtree

Averaging the height of the right subtree from the height of the left subtree

Averaging the height of the right subtree from the height of the left subtree

Averaging the height of the left subtree from the height of the right subtree

Averaging the height of the left subtree from the height of the right subtree

Once you attempt the question then PrepInsta explanation will be displayed.

Start

Question 9

Time: 00:00:00
When do we use RR rotation in AVL Trees.

when the new node is inserted to the left of the right subtree

when the new node is inserted to the left of the right subtree

when the new node is inserted to the right of the left subtree

when the new node is inserted to the right of the left subtree

when the new node is inserted to the right of the right subtree

when the new node is inserted to the right of the right subtree

when the new node is inserted to the left of the left subtree

when the new node is inserted to the left of the left subtree

Once you attempt the question then PrepInsta explanation will be displayed.

Start

Question 10

Time: 00:00:00
How many fields do we require for representing an AVL tree?

One

One

Two

Two

Three

Three

Four

Four

Once you attempt the question then PrepInsta explanation will be displayed.