Unit 3 - Week 1 Quiz
Unit 3 - Week 1 Quiz
Unit 3 - Week
1 Quiz
Course
outline
Week 1 Quiz
The due date for submitting this assignment has passed.
How to access As per our records you have not submitted this Due on 2018-08-23, 23:59 IST.
the portal assignment.
Week 1: All questions carry equal weightage. All Python code is assumed to be executed using Python3. You
Introduction may submit as many times as you like within the deadline. Your final submission will be graded.
Week 1 Quiz 1) What does g(31415927) return, for the following function definition?
Week 2 Quiz
Week 2
No, the answer is incorrect.
Programming
Assignment Score: 0
Feedback:
Week 3: Lists, d is the largest power of 10 that is smaller than 31415927. In general, for non-negative inputs x, g(x) ounts
inductive the digits in x.
function
definitions, Accepted Answers:
sorting (Type: Numeric) 8
1 point
Week 3
Programming 2) What is the value of h(231,8) for the function below?
Assignment
def h(m,n):
Week 4: Sorting, ans = 0
Tuples,
while (m >= n):
Dictionaries,
Passing (ans,m) = (ans+1,m-n)
Functions, List return(ans)
Comprehension
Week 4 Quiz
© 2014 NPTEL - Privacy & Terms - Honor Code - FAQs -
A project of In association with
Funded by
def h(n):
Week 5
Programming f = 0
Assignment for i in range(1,n+1):
if n%i == 0:
Week 6: f = f + 1
Backtracking, return(f%2 == 1)
scope, data
structures; The function h(n) given above returns True for a positive number n whenever:
stacks, queues
and heaps
n is a multiple of 2
n is a prime number
Week 7: Classes,
objects and user n is a perfect square
defined
datatypes No, the answer is incorrect.
Score: 0
Week 7 Quiz
Feedback:
f is the number of factors of n between 1 and n. Factors of n occur in pairs (x,y) so that x*y = n. If n is a
Week 8:
Dynamic perfect square, one factor will be its own pair, so the number of factors is odd and f returns True. If n is not
programming, a perfect square, the number of factors is even and f returns False.
wrap-up
Accepted Answers:
n is a perfect square
Week 8
Programming 4) Consider the following function f. 1 point
Assignment
def f(m):
Text Transcripts if m == 0:
return(0)
DOWNLOAD else:
VIDEOS
return(m+f(m-1))
End