Programming, Data Structures and Algorithms Using Python - Unit 3 - Week 1 Quiz

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

Programming, Data Structures And Algorithms Using Python - - Unit 3... https://onlinecourses.nptel.ac.in/noc23_cs95/unit?

unit=23&assessment=145

(https://swayam.gov.in) (https://swayam.gov.in/nc_details/NPTEL)

vani.yamani@gmail.com 

NPTEL (https://swayam.gov.in/explorer?ncCode=NPTEL) » Programming, Data Structures And

Algorithms Using Python (course)


Click to register
for Certification
exam
(https://examform.nptel.ac.in
Week 1 Quiz
/2023_10 Your last recorded submission was on 2023-07-26, 15:53 IST Due date: 2023-08-09, 23:59 IST.
/exam_form All questions carry equal weightage. All Python code is assumed to be executed using Python3. You
/dashboard) may submit as many times as you like within the deadline. Your final submission will be graded.
Note:

If already • If the question asks about a value of type string, remember to enclose your answer in
registered, click single or double quotes.
to check your • If the question asks about a value of type list, remember to enclose your answer in square
payment status brackets and use commas to separate list items.

1) What is the value of g(728) for the function below?

Course def g(y):


outline b = 0
while y >= 3:
How does an (y,b) = (y/3,b+1)
NPTEL online return(b)
course work?
()
5
Week 1 :
2.5 points
Introduction
() 2) What is f(90)-f(89), given the definition of f below?

Week 1 Quiz
()

1 of 3 08-08-2023, 15:21
Programming, Data Structures And Algorithms Using Python - - Unit 3... https://onlinecourses.nptel.ac.in/noc23_cs95/unit?unit=23&assessment=145

Quiz: Week 1
def f(n):
Quiz
s = 0
(assessment?
for i in range(2,n):
name=145)
if n%i == 0 and i%2 == 1:
Week 2: s = s+1
Basics of return(s)
Python ()

Week 2 Quiz 5
() 2.5 points

3) Consider the following function h. 2.5 points


Week 2
Programming
def h(n):
Assignment ()
s = True
for i in range(1,n+1):
Week 3: Lists,
if i*i == n:
inductive
s = False
function
definitions, return(s)
sorting ()
The function h(n) given above returns False for a positive number n if and only if:
Week 3
n is an odd number.
Programming
Assignment () n is a prime number.
n is a perfect square.
Text n is a composite number.
Transcripts ()
4) Consider the following function foo. 2.5 points

Books ()
def foo(m):
if m == 0:
Download
return(0)
Videos ()
else:
return(m+foo(m-1))
Problem
Solving
Which of the following is correct?
Session -
July 2023 () The function always terminates with foo(n) = factorial of n
The function always terminates with foo(n) = n(n+1)/2
The function terminates for nonnegative n with foo(n) = factorial of n
The function terminates for nonnegative n with foo(n) = n(n+1)/2

You may submit any number of times before the due date. The final submission will be considered
for grading.
Submit Answers

2 of 3 08-08-2023, 15:21
Programming, Data Structures And Algorithms Using Python - - Unit 3... https://onlinecourses.nptel.ac.in/noc23_cs95/unit?unit=23&assessment=145

3 of 3 08-08-2023, 15:21

You might also like