SCHOOL NAME: ___________________________
STUDENT NAME: ___________________________
ROLL NO: __________ CLASS: XI SUBJECT: Informatics Practices
WORKSHEET – NUMPY ARRAYS
Total Marks: 40 Duration: 1 Hour
PART A – Multiple Choice Questions (10 × 1 = 10 Marks)
1. NumPy is mainly used for: a) Word processing b) Numerical computation c) Web development d)
Database management
2. The command to import NumPy is: a) import numpy b) import numpy as np c) include numpy d) from
numpy import all
3. The function used to create an array from a list is: a) array() b) list() c) arr() d) np()
4. [Link](5) creates: a) Array of five 0s b) Array of five 1s c) Array of numbers 0 to 5 d) Empty array
5. The data type of NumPy arrays is stored in which attribute? a) dtype b) type c) datatype d) structure
6. [Link](2, 10, 2) will produce: a) [2, 4, 6, 8] b) [2,3,4,5,6,7,8,9] c) [2,6,10] d) [4,6,8,10]
7. Which function gives the shape of the array? a) shape() b) [Link]() c) [Link] d) len()
8. reshape() is used to: a) Change data type b) Change shape of array c) Reverse array d) Split array
9. The axis parameter in NumPy represents: a) Dimension along which operation is performed b) File
path c) Index location only d) None of the above
10. Which function combines two arrays horizontally? a) [Link]() b) [Link]() c)
[Link](axis=0) d) [Link]()
PART B – Error and Output Based Questions (10 × 3 = 30 Marks)
11. Find and correct the error:
import numpy
a = [Link]([1,2,3,4])
print(a)
Answer: ____________________________________________
12. Predict the output:
import numpy as np
a = [Link](2,10,2)
print(a)
print(a[2])
Answer: ____________________________________________
13. Predict the output:
import numpy as np
x = [Link]([[5,10],[15,20]])
print([Link])
print([Link])
Answer: ____________________________________________
14. Identify error:
import numpy as np
a = [Link]([[1,2,3],[4,5,6]])
print(a[2][0])
Answer: ____________________________________________
15. Output:
import numpy as np
a = [Link](0,5,6)
print(a)
Answer: ____________________________________________
16. Find error:
import numpy as np
a = [Link](1,10).reshape(2,5)
print(a)
Answer: ____________________________________________
17. Output:
import numpy as np
arr = [Link]([[1,2,3],[4,5,6]])
print(arr[1,:2])
Answer: ____________________________________________
18. Identify error:
import numpy as np
arr = [Link]([1,2,3,4,5])
print(arr[-6])
Answer: ____________________________________________
19. Output:
import numpy as np
a = [Link]([[10,20],[30,40]])
b = [Link]([[1,2],[3,4]])
print(a+b)
print(a*b)
Answer: ____________________________________________
20. Output:
import numpy as np
x = [Link](1,10).reshape(3,3)
print(x[1:,1:])
Answer: ____________________________________________