BSTQuiz
BSTQuiz
Correct
Mark 1.00 out of 1.00
Flag question
Question text
In a Heap tree
Question 1Select one:
Values in a node is greater than every value in left sub tree and smaller than right sub tree.
Question 2
Incorrect
Mark 0.00 out of 1.00
Flag question
Question text
Which of following figures is a height-balanced binary tree?
a.
b.
c.
d.
Feedback
Your answer is incorrect.
Flag question
Question text
Select the most correct definition of a tree:
(1)
(3)
(2)
Feedback
The correct answer is: (2)
Question 4
Correct
Mark 1.00 out of 1.00
Flag question
Question text
What is the result of the breadth first traverse of the binary search tree T, after inserting the
following keys into the tree sequentially (suppose T is empty before insertion):
7, 8, 4, 0, 1, -1, 10, 24
Question 4Select one:
7, 4, 8, 0, 10, -1, 1, 24
24, 10, 8, 7, 4, 1, 0, -1
-1, 0, 1, 4, 7, 8, 10, 24
7, 4, 8, 0, 10, 1, -1, 24
Feedback
The correct answer is: 7, 4, 8, 0, 10, -1, 1, 24
Question 5
Correct
Mark 1.00 out of 1.00
Flag question
Question text
2.
3.
1.
4.
Feedback
The correct answer is: 4.
Question 6
Correct
Mark 1.00 out of 1.00
Flag question
Question text
What does the following function do?
public void func(Node p)
{ if(p==null) return;
func(p.left());
func(p.right());
System.out.println(p.info);
}
a.
Level-order traversal with the tree with root p
b.
Post-order traversal with the tree with root p
c.
In-order traversal with the tree with root p
d.
Pre-order traversal with the tree with root p
Feedback
Your answer is correct.
The correct answer is: Post-order traversal with the tree with root p
Question 7
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Figure below is a height-balanced binary tree (for every node p of T, the heights of the
children of p differ by at most 1). If a node inserted as child of the node R, how many nodes
will become unbalanced?
a.
2
b.
0
c.
1
d.
3
Feedback
Your answer is correct.
The correct answer is: 1
Question 8
Correct
Mark 1.00 out of 1.00
Flag question
Question text
In all binary trees, there are 2i nodes at level i.
Question 8Answer
True
False
Feedback
The correct answer is 'False'.
Question 9
Correct
Mark 1.00 out of 1.00
Flag question
Question text
To implement an AVL tree, a concept balance factor is introduced (bal = height(right)-
height(left). An AVL tree is created using data :{10,90,5,1,8,0,2,9}. What is the balance factor of
the node 10?
Question 9Select one:
-1
2
Feedback
The correct answer is: -1
Question 10
Correct
Mark 1.00 out of 1.00
Flag question
Question text
What is the breadth-first traversal of a tree below after deleting the node 6 by copying?
5, 2, 7, 1, 4, 9, 8
2, 5, 7, 1, 4, 9, 8
5, 2, 7, 4, 1, 9, 8
2, 1, 5, 4, 7, 9, 8
Feedback
The correct answer is: 5, 2, 7, 1, 4, 9, 8
Question 11
Correct
Mark 1.00 out of 1.00
Flag question
Question text
What is the minimum number of nodes in a nearly complete binary tree with height 4?
(In a tree the height of root is 1, and a binary tree with height h is called nearly
complete if the tree is complete at level d for d = 1, 2, ..., h-1, and the leaves in the last
level are all in the leftmost positions).
Question 11Select one:
8
Feedback
The correct answer is: 8
Question 12
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Given a binary tree below. What is a result ofpre-order traverse?
Question 12Select one:
E, C, H, F, B, D, I, G
B, H, F, C, I, G, D, B
B, C, E, F, H, D, G, I
B, C, E, F, H, D, I, G
Feedback
The correct answer is: B, C, E, F, H, D, G, I
Question 13
Correct
Mark 1.00 out of 1.00
Flag question
Question text
State True or False: "A balanced tree is one whose root has many more left descendents than
right descendants, or vice versa."
Question 13Select one:
True
False
Feedback
The correct answer is: False
Question 14
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Consider the AVL tree below. What is the breadth first traversal of the tree after inserting a node
with value 3?
6, 2, 7, 1, 3, 5, 9, 4
6, 2, 7, 1, 5, 9, 3, 4
6, 2, 7, 1, 4, 9, 3, 5
6, 2, 7, 1, 3, 4, 9, 5
Feedback
The correct answer is: 6, 2, 7, 1, 4, 9, 3, 5
Question 15
Correct
Mark 1.00 out of 1.00
Flag question
Question text
What is the complexity of adding an element to the heap?
a.
O(log n)
b.
O( n)
c.
O(nlog n)
d.
O(1)
Feedback
Your answer is correct.
The correct answer is: O(log n)
Question 16
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Select the correct statement.
(Note: full binary tree = proper binary tree = 2-tree)
Question 16Select one:
Question 17
Incorrect
Mark 0.00 out of 1.00
Flag question
Question text
The complexity of deleting any arbitrary node value element from heap is
b.
O(nlogn)
c.
O(n2)
d.
O(logn)
Feedback
Your answer is incorrect.
The correct answer is: O(logn)
Question 18
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Specify the correct implementation of pre-order traverse algorithm for binary trees.
void preOrder(Node p)
{ if (p == null) { visit(p); preOrder(p.left); preOrder(p.right); }
}
void preOrder(Node p)
{ if (p != null) { visit(p); preOrder(p.left); preOrder(p.right); }
}
void preOrder(Node p)
{ visit(p); preOrder(p.left); preOrder(p.right); }
void preOrder(Node p)
{ if (p != null) { preOrder(p.left); visit(p); preOrder(p.right); }
}
Feedback
The correct answer is: void preOrder(Node p)
{ if (p != null) { visit(p); preOrder(p.left); preOrder(p.right); }
}
Question 19
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Select the correct statement.
Suppose T is a binary tree with 9 nodes. What is the minimum possible height of T?
(Note: In a tree the height of root is 1)
Question 19Select one:
5
Feedback
The correct answer is: 4
Question 20
Correct
Mark 1.00 out of 1.00
Flag question
Question text
State True or False:"In a binary search tree, all the nodes that are left descendants of node A have
key values greater than A; all the nodes that are A's right descendants have key values less than
(or equal to) A."
Question 20Select one:
True
False
Feedback
The correct answer is: False
Question 21
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Select the most correct definition of a binary tree:
(3)
(2)
(1)
Feedback
The correct answer is: (3)
Question 22
Incorrect
Mark 0.00 out of 1.00
Flag question
Question text
Which of the below diagrams is/are AVL tree/s?
i.
ii.
a.
both I and II
b.
none of the mentioned
c.
only I
d.
only II
Feedback
Your answer is incorrect.
The correct answer is: only II
Question 23
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Specify the correct statement about a binary search tree(select the most suitable one).
Question 23Select one:
In a binary search tree, all the nodes that are left descendants of node A have key values
greater than A; all the nodes that are A's right descendants have key values less than (or
equal to) A.
The main purpose of balancing a tree is to keep the tree in good shape.
Feedback
The correct answer is: It is necessary to build a tree with optimized height to stimulate
searching operation.
Question 24
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Consider the following min-heap:
What will be the value in the root after deleting root node (value 1) and rearranging the
heap?
a.
100
b.
3
c.
2
d.
17
Feedback
Your answer is correct.
The correct answer is: 2
Question 25
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Consider the binary tree below. Which statement is correct?
(full binary tree = proper binary tree = 2-tree)
Flag question
Question text
What is the minimum number of nodes in a full binary tree with height 3?
(In a tree the height of root is 1, and in a full binary tree every node other than the
leaves has two children).
5
Feedback
The correct answer is: 5
Question 27
Correct
Mark 1.00 out of 1.00
Flag question
Question text
A binary tree is balanced if the difference between left and right subtree of every node is
not more than ____
a.
3
b.
2
c.
1
d.
0
Feedback
Your answer is correct.
The correct answer is: 1
Question 28
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Heap can be used as ________________
a.
Priority queue
b.
None of the mentioned
c.
Stack
d.
A decreasing order array
Feedback
Your answer is correct.
The correct answer is: Priority queue
Question 29
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Specify the correct implementation of in-order traverse algorithm for binary trees.
void inOrder(Node p)
{ inOrder(p.left); visit(p); inOrder(p.right); }
void inOrder(Node p)
{ if (p != null) { inOrder(p.left); visit(p); inOrder(p.right); }
}
void inOrder(Node p)
{ if (p != null) { visit(p); inOrder(p.left); inOrder(p.right); }
}
void inOrder(Node p)
{ if (p == null) { inOrder(p.left); visit(p); inOrder(p.right); }
}
Feedback
The correct answer is: void inOrder(Node p)
{ if (p != null) { inOrder(p.left); visit(p); inOrder(p.right); }
}
Question 30
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Question 30Select one:
2.
4.
1.
3.
Feedback
The correct answer is: 2.
Question 31
Correct
Mark 1.00 out of 1.00
Flag question
Question text
In a max-heap, element with the greatest key is always in the which node?
a.
First node of right sub tree
b.
First node of left sub tree
c.
Leaf node
d.
root node
Feedback
Your answer is correct.
The correct answer is: root node
Question 32
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Consider the binary tree below. Which statement is correct?
(full binary tree = proper binary tree = 2-tree)
Question 33
Correct
Mark 1.00 out of 1.00
Flag question
Question text
12
41
15
16
Feedback
The correct answer is: 15
Question 34
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Balanced binary tree with n items allows the lookup of an item in ____ worst-case time.
a.
O(log n)
b.
O(1)
c.
O(nlog 2)
d.
O( n)
Feedback
Your answer is correct.
The correct answer is: O(log n)
Question 35
Correct
Mark 1.00 out of 1.00
Flag question
Question text
The in-order traverse of tree will yield a sorted listing of elements of tree in
Question 35Select one:
None of others
Binary trees
Heaps
Feedback
The correct answer is: Binary search trees