Python Programming - Arrays
Exercise : Arrays - General Questions
- Arrays - General Questions
36.
How do you check if all elements in a NumPy array
arr are non-zero?
Answer: Option
Explanation:
The code
np.all(arr != 0) checks if all elements in the array are non-zero.
37.
What does the NumPy function
numpy.concatenate((arr1, arr2), axis=0) do?
Answer: Option
Explanation:
The
numpy.concatenate() function joins the arrays along the specified axis.
38.
How can you reshape a NumPy array
arr into a 2x3 matrix?
Answer: Option
Explanation:
The
arr.reshape(2, 3) method reshapes the array into a 2x3 matrix.
39.
Given two NumPy arrays
arr1 and arr2, what does np.column_stack((arr1, arr2)) do?
Answer: Option
Explanation:
The
np.column_stack() function stacks the arrays horizontally.
40.
What does the NumPy function
numpy.unique(arr) return?
Answer: Option
Explanation:
The
numpy.unique() function returns the array with only unique elements.
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers