Python Programming - Arrays
Exercise : Arrays - General Questions
- Arrays - General Questions
71.
What does the NumPy function
numpy.random.randint(1, 100, size=(3, 3)) do?
Answer: Option
Explanation:
The
numpy.random.randint() function creates a random integer array of the specified size.
72.
How can you find the maximum value along a specific axis in a NumPy array
arr?
Answer: Option
Explanation:
The
np.max() function can be used with the axis parameter to find the maximum value along a specific axis.
73.
Given a NumPy array
arr = np.array([[1, 2, 3], [4, 5, 6]]), how can you access the element 5?Answer: Option
Explanation:
The indexing starts from 0, so
arr[1, 2] refers to the element in the second row and second column.
74.
What is the purpose of the NumPy function
numpy.flip(arr, axis=1)?
Answer: Option
Explanation:
The
numpy.flip() function flips the array horizontally along the specified axis.
75.
How can you find the index of the minimum value in a NumPy array
arr?
Answer: Option
Explanation:
The
np.argmin() function returns the index of the minimum value in the array.
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers