GATEverse
← GATE CSE 2007

Q46

MCQ2 marks, −0.5

Consider the following C program segment where CellNode\text{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\text{GetValue} when a pointer to the root of a binary tree is passed as its argument is:

Sign in to save attempts.

Loading…