Week 1 - Quiz (Programming, Datastructures and Algorithms using Python) (NPTEL 2022 - CS26)
- Get link
- X
- Other Apps
What is the value of f(3456) for the function below?
def f(x):
d=0
while x >= 1:
(x,d) = (x/7,d+1)
return(d)
Accepted Answers:
(Type: Numeric) 5
2.5 points
What is h(60)-h(45), given the definition of h below?
def h(n):
s = 0
for i in range(2,n):
if n%i == 0:
s = s+i
return(s)
Accepted Answers:
(Type: Numeric) 75
2.5 points
For what value of n would g(375,n) return 4?
def g(m,n):
res = 0
while m >= n:
(res,m) = (res+1,m/n)
return(res)
Accepted Answers:
(Type: Numeric) 4
2.5 points
2.5 points
Consider the following function f:
def mys(m):
if m == 1:
return(1)
else:
return(m+mys(m-1))
Which of the following is correct?Yes, the answer is correct.
Accepted Answers:
- Get link
- X
- Other Apps
Comments
Post a Comment