Report Bug

Qus

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)
Qusनिम्नलिखित पायथन कोड का ऑब्ज़र्व करें?


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
D. a() is tail recursive but b() isn’t


Solution
C. b() is tail recursive but a() isn’t



Explanation
A recursive function is tail recursive when recursive call is executed by the function in the last.
CCC Online Test 2021 CCC Practice Test Hindi Python Programming Tutorials Best Computer Training Institute in Prayagraj (Allahabad) Best Java Training Institute in Prayagraj (Allahabad) Best Python Training Institute in Prayagraj (Allahabad) O Level Online Test in Hindi Bank SSC Railway TET UPTET Question Bank career counselling in allahabad Sarkari Naukari Notification Best Website and Software Company in Allahabad Sarkari Exam Quiz