NPTEL The Joy of Computing using Python Week 10 Assignment Answers 2025

NPTEL The Joy of Computing using Python Week 10 Assignment Answers 2025

1. Which of the following statements is correct about Python’s dynamic typing?

  • Variables must be declared before use.
  • A variable’s type can change at runtime.
  • Python does not allow reassignment of variable types.
  • Python is statically typed.
Answer :- For Answers Click Here 

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

  • toPmiagmnrh
  • toPmiagmnrPg
  • tnoaigmooP
  • toPmiagmnr
Answer :- 

3. What does the following code print?

  • 6
  • 7
  • 9
  • Value Error
Answer :- 

4. Which statement about find() and index() in Python is true?

  • Both return -1 if the substring is not found.
  • index() raises an error if not found, but find() returns -1.
  • index() and find() behave identically.
  • Both return the first index of occurrence.
Answer :- 

5. What will be the output of the following Python code?

print(17 % -5)

  • 3
  • 2
  • 0
  • -3
Answer :- For Answers Click Here 

6. Which method in PIL is used to resize an image while maintaining the aspect ratio?

  • resize()
  • thumbnail()
  • reshape()
  • aspect ratio resize()
Answer :- 

7. Which of the following correctly finds all numbers divisible by 3 but not by 5 in a list?

nums = range(1, 50)

  • [x for x in nums if x % 3 == 0 and x % 5 != 0]
  • [x for x in nums if x % 5 != 0 or x % 3 == 0]
  • [x for x in nums if x % 3 != 0 and x % 5 == 0]
  • filter(lambda x: x % 3 == 0 and x % 5 == 0, nums)
Answer :- 

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

  • 2
  • 5
  • [5, 6]
  • 4
Answer :- 

9. For which value of axis the output is [5, 7, 9] in the below code?

  • 0
  • 1
  • 2
  • axis argument is not required.
Answer :- 

10. What will be the shape of the resulting NumPy array?

  • (3, 2)
  • (4, 3)
  • (3, 4)
  • (4, 2)
Answer :- For Answers Click Here