Binary Search Tree(BST) Online Quiz
This is the quiz for those who are preparing for programming in C, Java and other languages as well and want to improve their knowledge on BST via Questions and Answers.
Binary search trees
Quizsummary
0 of 9 questions completed
Questions:
 1
 2
 3
 4
 5
 6
 7
 8
 9
Information
Binary search trees
You have already completed the quiz before. Hence you can not start it again.
Quiz is loading...
You must sign in or sign up to start the quiz.
You have to finish following quiz, to start this quiz:
Results
0 of 9 questions answered correctly
Your time:
Time has elapsed
You have reached 0 of 0 points, (0)
Categories
 Not categorized 0%
 1
 2
 3
 4
 5
 6
 7
 8
 9
 Answered
 Review

Question 1 of 9
1. Question
Which of the following is a selfadjusting or selfbalancing Binary Search Tree
Correct
Incorrect

Question 2 of 9
2. Question
Consider the following leftrotate and rightrotate functions commonly used in selfadjusting BSTs
T1, T2 and T3 are subtrees of the tree rooted with y (on left side)
or x (on right side)
y x
/ \ Right Rotation / \
x T3 – – – – – – – > T1 y
/ \ <        / \ T1 T2 Left Rotation T2 T3 Which of the following is tightest upper bound for leftrotate and rightrotate operations.Correct
Incorrect

Question 3 of 9
3. Question
Which of the following is true about AVL and Red Black Trees?
Correct
Incorrect

Question 4 of 9
4. Question
Consider the following AVL tree.
60
/ \
20 100
/ \
80 120
Which of the following is updated AVL tree after insertion of 70
A
70
/ \
60 100
/ / \
20 80 120B
100
/ \
60 120
/ \ /
20 70 80C
80
/ \
60 100
/ \ \
20 70 120D
80
/ \
60 100
/ / \
20 70 120Correct
Incorrect

Question 5 of 9
5. Question
Suppose we have a balanced binary search tree T holding n numbers.
We are given two numbers L and H and wish to sum up all the numbers in T that lie between L and H. Suppose there are m such numbers in T. If the tightest upper bound on the time to compute the sum is O(nalogb n + mc logd n), the value of a + 10b + 100c + 1000d is ____.Correct
Incorrect

Question 6 of 9
6. Question
Consider the same code as given in above question. What does the function print() do in general?
The function print() receives root of a Binary Search Tree (BST) and a positive integer k as arguments.
// A BST node
struct node {
int data;
struct node *left, *right;
};int count = 0;
void print(struct node *root, int k)
{
if (root != NULL && count < = k) { print(root>right, k);
count++;
if (count == k)
printf(“%d “, root>data);
print(root>left, k);
}
}Correct
Incorrect

Question 7 of 9
7. Question
A binary tree of depth “d” is an almost complete binary tree if
Correct
Incorrect

Question 8 of 9
8. Question
A characteristic of the data that binary search uses but the linear search ignores is
the___________.
Correct
Incorrect

Question 9 of 9
9. Question
.In order to get the contents of a Binary search tree in ascending order, one has to traverse it in
Correct
Incorrect