Recursion in Python MCQs Exercise II


Ques 1 Recursion


What is the output of the following Python Code?


def xyz(i,j,k):
    if i&j==0:
        print(i,j)
        return -1
    else:
        xyz(i-1,j+1,k)
xyz(30,60,10)

  a) 26 64
  b) 27 62
  c) 67 34
  d) 30 60


a is the correct option





Ques 2 Recursion


What is the output of the following Python Code?


def fun(a,b):
    if a>0:
        return (a%b)+fun(a//b,b)
    else:
        return 0
print(fun(451,11))

  a) 17
  b) 11
  c) 10
  d) 9


b is the correct option