Question 1
Consider the expression tree shown. Each leaf represents a numerical value, which can either be 0 or 1. Over all possible choices of the values at the leaves, the maximum possible value of the expression represented by the tree is ___.
4
6
8
10
Question 2
Consider evaluating the following expression tree on a machine with load-store architecture in which memory can be accessed only through load and store instructions. The variables a, b, c, d and e initially stored in memory. The binary operators used in this expression tree can be evaluate by the machine only when the operands are in registers. The instructions produce results only in a register. If no intermediate results can be stored in memory, what is the minimum number of registers needed to evaluate this expression?

2
9
5
3
Question 3
What is the maximum height of any AVL-tree with 7 nodes? Assume that the height of a tree with a single node is 0.
2
3
4
5
Question 4
The maximum number of binary trees that can be formed with three unlabeled nodes is:
1
5
4
3
Question 5
The inorder and preorder traversal of a binary tree are d b e a f c g and a b d e c f g, respectively. The postorder traversal of the binary tree is:
d e b f g c a
e d b g f c a
e d b f g c a
d e f g b c a
Question 6
A complete n-ary tree is a tree in which each node has n children or no children. Let I be the number of internal nodes and L be the number of leaves in a complete n-ary tree. If L = 41, and I = 10, what is the value of n?
3
4
5
6
Question 7
Consider the following C program segment where CellNode represents a node in a binary tree:
struct CellNode
{
struct CellNOde *leftChild;
int element;
struct CellNode *rightChild;
};
int GetValue(struct CellNode *ptr)
{
int value = 0;
if (ptr != NULL)
{
if ((ptr->leftChild == NULL) &&
(ptr->rightChild == NULL))
value = 1;
else
value = value + GetValue(ptr->leftChild)
+ GetValue(ptr->rightChild);
}
return(value);
}
The value returned by GetValue() when a pointer to the root of a binary tree is passed as its argument is:
the number of nodes in the tree
the number of internal nodes in the tree
the number of leaf nodes in the tree
the height of the tree
Question 8
A scheme for storing binary trees in an array X is as follows. Indexing of X starts at 1 instead of 0. the root is stored at X[1]. For a node stored at X[i], the left child, if any, is stored in X[2i] and the right child, if any, in X[2i+1]. To be able to store any binary tree on n vertices the minimum size of X should be.
log2n
n
2n + 1
2^n — 1
Question 9
Consider a rooted Binary tree represented using pointers. The best upper bound on the time required to determine the number of subtrees having having exactly 4 nodes O(na Logn b). Then the value of a + 10b is ________
1
11
12
21
Question 10
In a complete k-ary tree, every internal node has exactly k children. The number of leaves in such a tree with n internal nodes is
nk
(n - 1)k + 1
n(k - 1) + 1
n(k - 1)
There are 40 questions to complete.