Attention! students who enrolled in the Joy of Computing using Python course.
I have provided probable answers for all 10 quiz questions for week 2’s assignment. I encourage you to utilize these hints as a guide and complete the assignment before the deadline for submission.
Table of Contents
Joy of Computing Using Python Week 2 Assignment Answers
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: Option D
For instant notification of any updates, Join us on telegram.
Q2. Which of the following is not the correct variable name
Answer: c. 32asd
Q3. Write the output of the following code.
L = [1,2,3,4,5,6,7,8,9]
print(L[::-1])
Answer: c. [9,8,7,6,5,4,3,2,1]
Q4. Predict the output of the following code:
L = [[1,2,3],[0,4,5],[0,0,6]]
for i in range (3):
for j in range(2,i-1,-1):
print(L[i][j], end = "")
Answer: b. 3 2 1 5 4 6
Q5. Find all the error(s)in the following code:
n = 10
1 = []
for i in range(10,n+10):
1.append(i**i)
for i in range (10,0,-1):
print(l[i])
Answer: a. Index out of range
b. Syntax error
Q6. What is the output of the following code:
def add_items(x,y):
x+= [1,2]
y+= (3,4)
l = [0]
t = (5,)
add_items(l, t)
print(l, end="")
print(t)
Answer: b. [0,1,2] (5,)
Q7. What is the correct syntax for defining a function in Python?
Answer: a. def function name():
Q8. What is the purpose of the continue statement in a for loop?
Answer: d. To skip the current iteration and move on to the next one, but only if a certain condition is met
Q9. How do you check if a number is even in Python?
Answer: a. if number % 2 == 0
Q10. What should be the value of _ to print all numbers from 0-10?
for i in range( _ ):
print(i)
Answer: a. 11
Joy of Computing Using Python Week 2 Programming Answers
Q1. Given an integer as an input, write a program to print that integer.
print(num,end="")
Q2. Given two integers as an input, write a program to print the sum of those two integers
print(num1+num2,end="")
Q3. You are given a number as an input. You have to display all the numbers from 0 till x.
for a in range(num+1):
if a==num:
print(a,end="")
else:
print(a)
TELEGRAM FOR NOTIFICATION | Click Here |
Follow on Google News (in one click) | Click Here |
Disclaimer: It is imperative to note that the responses provided here are solely for educational reference purposes. This platform does not guarantee the accuracy of the answers, hence it is strongly recommended to undertake your assignments independently.
Also Available:
NPTEL Joy of Computing using Python Assignment Answers Week 1
NPTEL The Joy of Computing using Python Assignment Answers Week 3