Python Programming - Arrays
Exercise : Arrays - General Questions
- Arrays - General Questions
26.
In NumPy, how do you find the indices of elements that satisfy a given condition in an array?
Answer: Option
Explanation:
The
np.where()
function in NumPy returns the indices of elements that satisfy a given condition.
27.
How do you perform element-wise multiplication of two NumPy arrays,
arr1
and arr2
?
Answer: Option
Explanation:
The
*
operator can be used for element-wise multiplication of two NumPy arrays.
28.
What does the NumPy function
numpy.eye(N, M=None, k=0)
do?
Answer: Option
Explanation:
The
numpy.eye()
function creates an identity matrix with dimensions N x N.
29.
How do you perform element-wise addition of a scalar value, 5, to a NumPy array
arr
?
Answer: Option
Explanation:
The
+
operator can be used for element-wise addition of a scalar value to a NumPy array.
30.
What is the purpose of the NumPy function
numpy.flip(arr, axis=None)
?
Answer: Option
Explanation:
The
numpy.flip()
function reverses the order of elements along a specified axis.
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers