Q. 78 Consider the following C program segment where Cell Node represents a node in
a binary tree
struct CellNode { struct CellNode *leftChild; int element; struct CellNode *rightChild; }; int Getvalue (struct CellNode *ptr) { int value = ; 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 Get Value 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
Answer: (C)
Explanation: