Python Programming - Arrays
Exercise : Arrays - General Questions
- Arrays - General Questions
91.
How can you calculate the mean of a NumPy array
arr along the second axis?
Answer: Option
Explanation:
The
mean() function with axis=1 calculates the mean along the second axis.
92.
What does the NumPy function
numpy.unique(arr) return?
Answer: Option
Explanation:
The
numpy.unique() function returns unique elements of the array.
93.
Given a NumPy array
arr = np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]]), how can you extract the diagonal elements?
Answer: Option
Explanation:
The
np.diag() function extracts the diagonal elements of the array.
94.
How can you concatenate two NumPy arrays
arr1 and arr2 vertically?
Answer: Option
Explanation:
The
np.vstack() function vertically stacks arrays.
95.
What does the NumPy function
numpy.arange(1, 10, 2) generate?
Answer: Option
Explanation:
The
numpy.arange() function generates an array with evenly spaced values.
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers