1
GATE CSE 2007
MCQ (Single Correct Answer)
+2
-0.6
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:
A
the number of nodes in the tree
B
the number of internal nodes in the tree
C
the number of leaf nodes in the tree
D
the height of the tree
2
GATE CSE 2007
MCQ (Single Correct Answer)
+2
-0.6
When searching for the key value 60 in a binary search tree, nodes containing the key values 10, 20, 40, 50, 70 80, 90 are traversed, not necessarily in the order given. How many different orders are possible in which these key values can occur on the search path from the root to the node containing the value 60?
A
35
B
64
C
128
D
5040
3
GATE CSE 2007
MCQ (Single Correct Answer)
+2
-0.6
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:
A
d e b f g c a
B
e d b g f c a
C
e d b f g c a
D
d e f g b c a
4
GATE CSE 2006
MCQ (Single Correct Answer)
+2
-0.6
An array X of n distinct integers is interpreted as a complete binary tree. The index of the first element of the array is 0. If the root node is at level 0, the level of element X[i], i ≠ 0, is
A
⌊log2 i⌋
B
⌈log2 (i + 1)⌉
C
⌊log2 (i + 1)⌋
D
⌈log2 i⌉
GATE CSE Subjects
Software Engineering
Web Technologies
EXAM MAP
Medical
NEETAIIMS
Graduate Aptitude Test in Engineering
GATE CSEGATE ECEGATE EEGATE MEGATE CEGATE PIGATE IN
Civil Services
UPSC Civil Service
Defence
NDA
Staff Selection Commission
SSC CGL Tier I
CBSE
Class 12