Numpy Test
1.
How do you create a 1D NumPy array with the values [10, 20, 30, 40, 50] ?
2.
Given the array arr = [Link]([10, 20, 30, 40, 50]) , how would you access the third element?
3.
How can you slice the first three elements from an array arr = [Link]([1, 2, 3, 4, 5]) ?
4.
What is the shape of a 3x2 matrix created using [Link]([[1, 2], [3, 4], [5, 6]]) ?
5.
What will be the result of adding [Link]([1, 2, 3]) to the 2D array [Link]([[4, 5, 6], [7, 8,
9]]) ?
6.
How would you reshape a 1D array of 9 elements arr = [Link](9) into a 3x3 matrix?
7.
What is the result of performing element-wise multiplication between two arrays a = [Link]([1, 2,
3]) and b = [Link]([4, 5, 6]) ?
8.
How can you calculate the sum of all elements in the array arr = [Link]([[1, 2], [3, 4]]) ?
9.
How would you compute the mean, median, and standard deviation of the array arr = [Link]([10,
20, 30, 40, 50]) ?
10.
How would you find the minimum and maximum values of the array arr = [Link]([100, 200, 300,
400, 500]) ?
11.
How do you create a 3x3 matrix of zeros using NumPy?
12.
How do you create a 4x4 identity matrix using NumPy?
13.
How would you create a 2x3 array filled with the value 7 using NumPy?
14.
How would you concatenate two arrays a = [Link]([1, 2, 3]) and b = [Link]([4, 5, 6])
into one array?
15.
How would you stack two arrays a = [Link]([1, 2, 3]) and b = [Link]([4, 5, 6])
vertically?
16.
How would you generate a 2x3 matrix of random integers between 0 and 10?
17.
How can you create a 3x3 matrix of ones using NumPy?
18.
How would you use [Link]() to return True for elements greater than 5 in the array arr =
[Link]([3, 6, 2, 8]) ?
19.
How can you find the unique elements of the array arr = [Link]([1, 1, 2, 2, 3, 3, 4]) ?
20.
How would you create a 3x3 array filled with the value 9 using the [Link]() function?
BY Pranjal Gajbhiye(AIE)
Happy Learning...