Python Programming - Arrays
Exercise : Arrays - General Questions
- Arrays - General Questions
66.
How can you calculate the sum of all elements in a NumPy array
arr?
Answer: Option
Explanation:
The
np.sum() function calculates the sum of all elements in the array.
67.
What does the NumPy function
numpy.arange(1, 10, 2) return?
Answer: Option
Explanation:
The
numpy.arange() function creates an array with values from start (inclusive) to stop (exclusive) with the specified step.
68.
How can you find the mean of a NumPy array
arr?
Answer: Option
Explanation:
The
np.mean() function calculates the mean of the array.
69.
Given two NumPy arrays
arr1 = np.array([1, 2, 3]) and arr2 = np.array([4, 5, 6]), what does np.dot(arr1, arr2) return?Answer: Option
Explanation:
The
np.dot() function calculates the dot product of two arrays.
70.
What is the purpose of the NumPy function
numpy.identity(3)?
Answer: Option
Explanation:
The
numpy.identity() function creates the identity matrix of the specified order.
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers