# The Joy of Computing using Python Assignment Answers Week 2 2022

NPTEL The Joy of Computing using Python Week 2 Assignment Answers, Hints, Solution

Students, are you enrolled in the Joy of Computing using Python course? So, here is the answers hints for all the quiz questions for this course week 2 assignment. You can read these hints and solve your assignment before the last date of submission.

## The Joy of Computing using Python Assignment Answers Week 2 NPTEL

Q1. What is the correct command to show the value stored in a variable?

a. show()
b. cout()
c. print()
d. out()

Q2. What will be the output of the following piece of code?

``````a = 'Bond'
b = 34
print('Hello Mr.', a, b+1)``````

a. Hello Mr. Bond 34

b. Hello Mr. 34

c. Hello Mr. Bond 35

d. Hello Mr. Bond 34

Answer: c. Hello Mr. Bond 35

Q3. What will be the output of the following code?

``In [3]: x=10 x=y print(x,y)``

a. 10,10

b. 10

c. No output

d. Error

Q4. What is the extension of a python file?

a. sc

b. py

c. md

d. Cp

Q5. What will be the output of the following code, if the given input is 5?

a. 25

b. 55555

c. 55

d. 5

Q6. Which of the following commands are correct to take input from a user?

a. n = input(‘Hello’)

b. n = input(“42”)

c. n = input(‘42’)

d. n = input(Hello)

e. n = input()

b. n = input(“42”)
c. n = input(‘42’)
e. n = input()

Q7. What will be the output of the following code if the input is ‘5’?

``````a = input('Enter a number')
b = int(a)
print(5*b)``````

a. 25

b. 25.0

c. Error

d.  5555

Q8. Which of the following blocks of codes are correct?(Assume x and y are initialized)

a.` `

`if(x==1):if(y==1):print(hey)`

b.

`if(x==1):print('statement')if(y==1):print('hey')`

c.

`if(x=1):print('statement')if(y=1):print('hey')`

d.

`if(x==1):print('statement')if(y=1):print('hey')`

Q9. Which of the following statements are correct regarding the following code?

``for i in range(a):``

a. I will take values from 0 to a.

b. I will take values from 1 to a.

c. I will take values from 0 to a-1.

d. I will take values from 1 to a-1.

Answer: c. I will take values from 0 to a-1.

Q10. What will be the output of the following code?

``````a = 0
while(a<10):
a=a+2
print(a)``````

a. 1,2,3,4,5,6,7,8,9,10

b. 2,4,6,8,10

c. 0,1,2,3,4,5,6,7,8,9,10

d. Error

Disclaimer: These answers are provided only for the purpose to help students to take references. This website does not claim any surety of 100% correct answers. So, this website urges you to complete your assignment yourself.

Also Available:

NPTEL Joy of Computing using Python Assignment Answers Week 1