# Programming, Data Structures And Algorithms Using Python - Week 7 Quiz | NPTEL | [Jan 2023]

## We want to add a function listmin() to the class Node that implements user defined lists such that listmin() computes the minimum value in a list of values of type int. An incomplete implementation of listmin() given below. You have to provide expressions to put in place of AAA, BBB and CCC.

```   def listmin(self):
if self.value == None:
return(AAA)
elif self.next == None:
return(BBB)
else:
return(CCC)
```
a. AAA: 0, BBB: self.value, CCC: min(self.value, self.next.listmin())
b. AAA: 0, BBB: self.value, CCC: min(self.value, self.next.value)
c. AAA: None, BBB: self.value, CCC: min(self.value, self.next.listmin())
d. AAA: None, BBB: self.value, CCC: min(self.value, self.next.value)

c. AAA: None, BBB: self.value, CCC: min(self.value, self.next.listmin())

## Suppose we add this function foo() to the class Tree that implements search trees. For a name mytree with a value of type Tree, what would mytree.foo() compute?

```def foo(self):
if self.isempty():
return(0)
elif self.isleaf():
return(1)
else:
return(self.left.foo() + self.right.foo())```
a. The sum of the elements in the tree
b. The maximum sum across all root to leaf paths in the tree
c. The length of the longest root to leaf path in the tree
d. The number of root to leaf paths in the tree.

d. The number of root to leaf paths in the tree.

a. 22
b. 28
c. 38
d. 52