NPTEL Joy Of Computing Using Python Week 10 Assignment 2025

Hey Folks, This article features NPTEL Joy Of Computing using Python Week 10 Assignment 2025 with 100% answers. In previous articles, we discussed the Week 9 Assignment. All answers are solved with proofs.

Also Read: NPTEL Joy Of Computing Using Python Week 9 Assignment 2025 Answers

Also, Join us on Telegram 👉 CLICK HERE

NPTEL Joy Of Computing Using Python Week 10 Assignment 2025

NPTEL Joy Of Computing Using Python Week 10 Assignment 2025

Last Date: 02-04-2025

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

A. Variables must be declared before use.
B. A variable’s type can change at runtime.
C. Python does not allow reassignment of variable types.
D. Python is statically typed.

Answer: [ B ] A variable’s type can change at runtime.

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

s="PythonProgramming"
print(s[2:15:3]+s[::-4]) {codeBox}

A. toPmiagmnrh
B. toPmiagmnrPg
C. tnoaigmooP
D. toPmiagmnr

Answer: [ C ]  tnoaigmooP 

s="PythonProgramming" print(s[2:15:3]+s[::-4])

Q3. What does the following code print?

s="Python Programming"
print(s.index('o', 5, 10)) {codeBox}

A. 6
B. 7
C. 9
D. Value Error

Answer: [ C ]  9

s="Python Programming" print(s.index('o', 5, 10))

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

A. Both return -1 if the substring is not found.
B. index() raises an error if not found, but find() returns -1.
C. index() and find() behave identically.
D. Both return the first index of occurrence.

Answer: [ B ] index() raises an error if not found, but find() returns -1.

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


print(17 % -5) {codeBox}

A. 3
B. 2
C. 0
D. -3

Answer: [ -3 ] D

print(17 % -5)

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

A. resize()
B. thumbnail()
C. reshape()
D. aspect ratio resize()

Answer: [ B ] thumbnail()

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


nums = range(1, 50)

A . [x for x in nums if x % 3 == 0 and x % 5 != 0]
B.  [x for x in nums if x % 5 != 0 or x % 3 == 0]
C.  [x for x in nums if x % 3 != 0 and x % 5 == 0]
D.  filter(lambda x: x % 3 == 0 and x % 5 == 0, nums)

Answer: [ A ] [x for x in nums if x % 3 == 0 and x % 5 != 0] 

Here, The number is divisible by 3 but not by 5. Only option 1 satisfies.

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

import numpy as np
arr=np.array([[1, [2, 3]], [4, [5, 6]], [7, [8, 9]]], dtype=object)
print(arr[1][1][0]) {codeBox}

A. 2
B. 5
C. [5, 6]
D. 4

Answer: [ B ] 5

What will be the output of the following code?

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


import numpy as np
a=np.array([[1, 2, 3], [4, 5, 6]])
print(np.sum(a, axis=0)) {codeBox}

A. 0
B. 1
C. 2
D. axis argument is not required.

Answer: [ A ] 0 

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

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


import numpy as np 
a = np.ones((3, 4))
b = np.ones((4, 2))
c = np.dot(a, b)
print(c.shape) {codeBox}

A. (3, 2)
B. (4, 3)
C. (3, 4)
D. (4, 2)

Answer: [ A ] (3, 2)

What will be the shape of the resulting NumPy array?

Conclusion

Join us on Telegram 👉 CLICK HERE

One Comment Please !

Post a Comment (0)
Previous Post Next Post