github

Made bySaurav Hathi

CSE - Practice Test -16

Q1:

What does the following Peace of code do?

Public void func (Tree root)

{

Func (root.key ());

Func (root.right ());

Printf ("% d” , root.data ());

{

Tags:
Section:
Data Structures
Options:
Q2:

Given the Pre order Traversal of a binary Search Tree, which of the following is the Post-order traversal of the tree?

Given pre order: 15, 6, 3, 2, 4, 7, 13, 9, 18, 17, 20

Tags:
Section:
Data Structures
Options:
Q3:

Consider the following code.

int foo (struct node * tree)

{ if (tree ==0)

return 0;

int lh = ht(tree →left);

int rh = ht (tree →right);

int ld = foo (tree →left);

int rd = foo (tree →right);

return max (lh + rh +1, max (ld, rd);

}

 

int ht (struct node *node)

{

If (node = = NULL)

return 0;

return 1 + max (ht (node →left), ht (node →right));

The value returned by foo when a pointer to the root of a binary tree is passed as its argument is

Tags:
Section:
Data Structures
Options:
Q4:

A BST (Binary Search Tree) is generated by inserting in order the following integers:

50, 15, 62, 5, 20, 58, 91, 3, 8, 37, 60, 24

The number of the nodes in the left sub tree & the right sub tree of the root respectively is:

Tags:
Section:
Data Structures
Options:
Q5:

In which of the following tree, Parent node has a key value greater or equal to the key value of both of its children? 

Tags:
Section:
Data Structures
Options:
Q6:

Which type of traversal of BST(Binary Search tree) outputs the values in sorted order

Tags:
Section:
Data Structures
Options:
Q7:

X is a binary tree node given that X has two children. Let Y be In order successor of X. which is true about Y.

Tags:
Section:
Data Structures
Options:
Q8:

The worst time to Perform Search operation on an BST

Tags:
Section:
Data Structures
Options:
Q9:

What is converse in-order of the Binary tree?

Tags:
Section:
Data Structures
Options:
Q10:

While inserting the elements 30, 20, 60, 25, 50, 22, 15, 80, 90, 55, 45, 18, 10, 65, 85 in an empty Binary Search tree in the sequence above, the height of the Binary Search tree is:

(consider root node at level 0) 

Tags:
Section:
Data Structures
Options:
Q11:

The height of a BST is given as h. consider the height of the tree as the no. of edges in the longest Path from the root to leaf. The maximum no. of nodes possible in the tree is? Height of the root node is taken as 0.

Tags:
Section:
Data Structures
Options:
Q12:

An array consists of n elements. We want to create a heap using the elements. The time complexity building a heap will be in order of

Tags:
Section:
Data Structures
Options:
Q13:

Heap cap can be used as:

Tags:
Section:
Data Structures
Options:
Q14:

A Priority-Queue is implemented as a Max-Heap. Initially, it has 5 elements. The level-order traversal of the heap is given below:

10, 8, 5, 3, 2

Two new elements ”1‘ and ”7‘ are inserted in the heap in that order. The level-order traversal of the heap after the insertion of the elements is:

Tags:
Section:
Data Structures
Options:
Q15:

A tree with n nodes will have how many edges?

Tags:
Section:
Data Structures
Options: