The Joy of Computing Using Python Week 2

The Joy of Computing using Python | NPTEL 2023 | Week 2 Assignment Solutions

ABOUT THE COURSE :

The Joy of Computing Using Python Week 2

A fun filled whirlwind tour of 30 hrs, covering everything you need to know to fall in love with the most sought after skill of the 21st century. The course brings programming to your desk with anecdotes, analogies and illustrious examples. Turning abstractions to insights and engineering to art, the course focuses primarily to inspire the learner's mind to think logically and arrive at a solution programmatically. As part of the course, you will be learning how to practice and culture the art of programming with Python as a language. At the end of the course, we introduce some of the current advances in computing to motivate the enthusiastic learner to pursue further directions.

Course Status      :   Upcoming
Course Type        :   Elective
Duration              : 12 weeks
Start Date            : 23 Jan 2023
End Date             :   14 Apr 2023
Exam Date          : 29 Apr 2023 IST
Enrollment Ends : 30 Jan 2023

CRITERIA TO GET A CERTIFICATE :

Average assignment score = 25% of average of best 8 assignments out of the total 12 assignments given in the course.
Exam score = 75% of the proctored certification exam score out of 100

Final score = Average assignment score + Exam score

YOU WILL BE ELIGIBLE FOR A CERTIFICATE ONLY IF AVERAGE ASSIGNMENT SCORE >=10/25 AND EXAM SCORE >= 30/75. If one of the 2 criteria is not met, you will not get the certificate even if the Final score >= 40/100.

NOTE: Please note that there will not be an unproctored programming exam for this course this term.

The Joy of Computing using Python Week 2 Assignment Solutions :-


Q1) What are the applications of Python?
a) Image processing and graphic design applications
b) Enterprise and business applications development
c) Operating systems 
d) All of the above
e) None of the above

Answer :- d

Q2) Which of the following is not the correct variable name
a) Abc
b) Abd23
c) 32asd
d) Ab_cd_23

Answer :- c

Q3) Write the output of the following code.

L = [1,2,3,4,5,6,7,8,9]
print(L[::-1])

a) [1,2,3,4,5,6,7,8,9]
b) [1,2,3,4,5,9,8,7,6]
c) [9,8,7,6,5,4,3,2,1]
d) Error

Answer :- c

Q4) Predict the output of the following code:

L = [[1,2,3],[0,4,5],[0,0,6]]
a) 3,2,1,5,4,6
b) 3 2 1 5 4 6
c) 0,0,0,0,0,0
d) 0 0 0 0 0 0

Answer :- b

Q5) Find all the error(s)in the following code:

a) Index out of range
b) Syntax error
c) Variable not defined
d) 'int' object does not support item assignment

Answer :- a,b

Q6) What is the output of the following code:
a) [0,1,2] (5,3,4)
b) [0,1,2] (5,)
c) [0] (5,3,4)
d) [0] (5,)

Answer :- b

Q7) What is the correct syntax for defining a function in Python?
a) def function name():
b) function function_name():
c) function_name():
d) def function_name:

Answer :- d

Q8) What is the purpose of the continue statement in a for loop?
a) To skip the rest of the current iteration and move on to the next one
b)  To terminate the loop and exit the loop block
c) To return to the top of the loop and start a new iteration
d) To skip the current iteration and move on to the next one, but only if a certain condition is met

Answer :- a

Q9) How do you check if a number is even in Python?
a) if number % 2 == 0
b) if number.is_even()
c) if number % 2 is 0
d) if number.even()

Answer :- a

Q10) What should be the value of _ to print all numbers from 0-10?
a) 11
b) 9
c) 10
d) None of the above

Answer :- 11

Week 2 Programming Assignment 1 :-

Given an integer as an input, write a program to print that integer.

Code :- 
print(num,end="")

Week 2 Programming Assignment 2 :-

Given two integers as an input, write a program to print the sum of those two integers.

Code :-
print(num1+num2,end="")

Week 2 Programming Assignment 3 :-

You are given a number as an input. You have to display all the numbers from 0 till x.

Code :-
for a in range(num+1):
 if a==num:
   print(a,end="")
 else:
   print(a)


Score:-100/100 🥳



Join Now


Previous Year Questions Now to Boost Your Exam Performance

LOADS OF LOGIC