0 of 4 Questions completed
Questions:
You have already completed the quiz before. Hence you can not start it again.
Quiz is loading…
You must sign in or sign up to start the quiz.
You must first complete the following:
0 of 4 Questions answered correctly
Your time:
Time has elapsed
You have reached 0 of 0 point(s), (0)
Earned Point(s): 0 of 0, (0)
0 Essay(s) Pending (Possible Point(s): 0)
What will be the output of factorial(4)?
def factorial(n):
if n == 0:
return 1
else:
return n * factorial(n – 1)
What will be the result of count_threes(12)?
def count_threes(n):
if n < 3:
return 0
else:
return n + count_threes(n % 3)
What is the output of sum_squares(3)?
def sum_squares(n):
if n == 0:
return 0
else:
return n ** 2 + sum_squares(n-1)
What is the value of sum_even(4)?
def sum_even(n):
if n <= 0:
return 0
elif n % 2 != 0:
return n – 1 + sum_even(n – 2)
else:
return n + sum_even(n – 2)