The Joy of Computing Using Python NPTEL Assignment 2 Answers

The Joy of Computing Using Python NPTEL Assignment 2 Answers

Are you looking for The Joy of Computing Using Python NPTEL week 2 Answers? You’ve come to the right place! Access the latest and most accurate solutions for your Assignment 2 in The Joy of Computing Using Python course

Course Link: Click Here

The Joy of Computing Using Python NPTEL week 2 Answers
The Joy of Computing Using Python NPTEL week 2 Answers

The Joy of Computing Using Python NPTEL week 2 Answers

Session: JULY- DEC 2024


Q1.Statement : If a variable is assigned multiple times, the latest value is not stored in the variable
False, the variable stores all values it was assigned
False, the variable stores the value from the latest assignment.
True, the variable stores the value from the second-last assignment.
True, the variable stores value from the initial assignment

Answer: False, the variable stores the value from the latest assignment.



Q2. Which of the following code blocks print – ”Hello Ram Lakshman and Hanuman !” ?

Answer: a),c)



For answers or latest updates join our telegram channel: Click here to join

These are The Joy of Computing Using Python NPTEL week 2 Answers


Q3. What aren’t the correct ways to inform python that input is an integer ?
in(input())
float(input())
int(input())
a = input()
a = int(a)

Answer: in(input())
float(input())



Q4. The following program outputs 722 –
For what value of a does the code output 8 ?
2
1
4
6

Answer: 4



For answers or latest updates join our telegram channel: Click here to join

These are The Joy of Computing Using Python NPTEL week 2 Answers


Q5. What does previous question calculate ?
Calculates the factorial of a.
Calculates the factorial of a and adds 2.
Calculates the a multiples of a starting from 1 and adds 2.
Calculates the factorial of a-1 and adds 2.

See also  The Joy of Computing using Python | Week 5

Answer: Calculates the factorial of a-1 and adds 2.



Q6. Which loop is used to perform a set of repetitive tasks based on condition in Python?
while loop
for loop
do-while loop
while-range loop

Answer: while loop


For answers or latest updates join our telegram channel: Click here to join

These are The Joy of Computing Using Python NPTEL week 2 Answers


Q7. What happens when the condition inside the if and while evaluate to false ?
Python interpreter ignores the if/while blocks, and halts the program.
Python interpreter ignores the if/while blocks, and proceeds the program from the lines after the if/while block.
Python interpreter executes the if/while blocks, and rest of the program.
Python interpreter executes the if/while, and the programs runs in an infinite loop.

Answer: Python interpreter ignores the if/while blocks, and proceeds the program from the lines after the if/while block.


Q8. The following program might/might not have an infinite loop. Does the program have infinite loop ?

No, the program doesn’t have infinite loop.
Yes, it can be prevented by updating the value of a before the if block at line 3
Yes, it can be prevented by removing both the if blocks inside the while loop.
Yes, but it cannot be prevented

Answer: Yes, it can be prevented by updating the value of a before the if block at line 3


For answers or latest updates join our telegram channel: Click here to join

These are The Joy of Computing Using Python NPTEL week 2 Answers


Q9. For which of the following values of name and age variables does the following code print ”You are lucky”?

See also  The Joy of Computing using Python | Week 10

aryan, 20
arjun, 19
aakash, 17
aatreya, 18

Answer: aatreya, 18


Q10. For which of the options among the previous question, the program doesn’t print anything.
aryan, 20
arjun, 19
aakash, 17
aatreya, 18

Answer: aakash, 17


For answers or latest updates join our telegram channel: Click here to join

These are The Joy of Computing Using Python NPTEL week 2 Answers

All Weeks of The Joy of Computing Using Python: Click here

For answers to additional Nptel courses, please refer to this link: NPTEL Assignment Answers