Vidyalelo
Python · Q45

Functions in Python

Programming · Python · question 45

Q45

Observe the following Python code? def a(n): if n == 0: return 0 else: return n*a(n - 1) def b(n, tot): if n == 0: return tot else: return b(n-2, tot-2)

A.
Both a() and b() aren't tail recursive
B.
Both a() and b() are tail recursive
C.
b() is tail recursive but a() isn't
Answer
D.
a() is tail recursive but b() isn't

Answer: Option C

Solution

Answer: Option C
No explanation is given for this question Let's Discuss on Board