GATEverse Practice, past papers & mock tests
GATE 2011
Programming & Data StructuresTreesmediumMCQ1 mark
Consider the pseudocode given below. The function DoSomething() takes as argument a pointer to the root of an arbitrary tree represented by the leftMostChild-rightSibling representation. Each node of the tree is of type treeNode. typedef struct treeNode* treeptr; struct treeNode { treeptr leftMostChild, rightSibling; }; int DoSomething (treeptr tree) { int value=0; if (tree != NULL) { if (tree->leftMostChild == NULL) value = 1; else value = DoSomething(tree->leftMostChild); value = value + DoSomething(tree->rightSibling); } return(value); } - 2014 SET 3 || MCQ || 2-mark - 2014 SET 2 || MCQ || 1-mark DATA STRUCTURE 67 Check Out Our GATE Courses & Secure Your Dream Rank! - 2011 MCQ || 1-mark | When the pointer to the root of a tree is passed as the argument to DoSomething, the value returned by the function corresponds to the
Save your progress

Related Programming & Data Structures PYQs