WorksheetsFOD_Lab
Total questions: 10
Worksheet time: 7mins
np.arange(1, 10, 3)
[1 4 7 10]
[1 4 7]
[1 3 6 9]
[1 4 7 9]
Which statement about np.linspace(0, 1, 5) is TRUE?
Step size is fixed
End value is excluded
Generates exactly 5 values including 1
Works same as np.arange()
a = np.array([1,2,3])
b = np.array([[1,2,3],[4,5,6]])
print(a + b)
(3,)
(2,3)
(3,2)
Error
What happens when a NumPy array created using view() is modified?
Original array remains unchanged
Only view changes
Both original and view change
Causes runtime error
Which axis value performs column-wise operations in a 2D NumPy array?
axis = -1
axis = 1
axis = 2
axis = 0
What will be the output of the following code?
a = np.array([10, 20, 30])
print(a < 25)
[True False False]
[False False False]
[True True False]
[True False True]
What will be the output of the following code?
a = np.array([1, 2, 3])
b = np.array([1.0, 2.0, 3.0])
print(np.array_equal(a, b))
True
False
Error due to different data types
Depends on NumPy version
The NumPy function used to create a shallow copy that shares memory with the original array is (a) .
Which NumPy function is used to split an array into multiple sub-arrays horizontally?
np.vsplit()
np.hsplit()
np.column_stack()
np.concatenate()
The NumPy function used to stack arrays column-wise is (a) .
