Instruction:-
#1. What is NumPy in Python?
#2. Which function is used to create a NumPy array?
#3. What is the output of the following code?
import numpy as np
a = np.array([1, 2, 3, 4])
print(a.shape)
#4. Which of the following will create a 2×3 array of zeros?
#5. How to find the datatype of elements in a NumPy array a?
#6. What does np.arange(5) generate?
#7. Which function is used to generate evenly spaced numbers over a specified interval?
#8. How do you reshape a NumPy array a of size 6 into a 2×3 array?
#9. Which of the following is NOT a valid NumPy data type?
#10. What does the np.sum() function do?
#11. How do you select the first element of a NumPy array a?
#12. Which of the following methods returns the transpose of a NumPy array?
#13. What will be the output of this code?
import numpy as np
a = np.array([[1, 2], [3, 4]])
print(a[1, 0])
#14. Which function generates random numbers in NumPy?
#15. How can you find the maximum value in a NumPy array a?
#16. If a = np.array([1, 2, 3]) and b = np.array([4, 5, 6]), what does a + b return?
#17. What is the shape of the array created by np.ones((3, 4))?
#18. What will np.sqrt(np.array([4, 9, 16])) return?
#19. Which method can be used to flatten a NumPy array?
#20. What does np.dot(a, b) do where a and b are arrays?
#21. Which library must be imported to use NumPy functions?
#22. What will np.array([1, 2, 3, 4]).dtype return?
#23. What will np.zeros(5) produce?
#24. What does this code do?
a = np.arange(1, 6)
print(a)
#25. Which of these is NOT a method to create an array?
Previous
Finish