Python Programming - Arrays
Exercise : Arrays - General Questions
- Arrays - General Questions
76.
Given a NumPy array
arr = np.array([[1, 2], [3, 4], [5, 6]]), what does arr.flatten(order='F') do?
Answer: Option
Explanation:
The
flatten() function with order='F' flattens the array in Fortran-style order.
77.
What does the NumPy function
numpy.linspace(1, 10, 5) return?
Answer: Option
Explanation:
The
numpy.linspace() function generates evenly spaced numbers over a specified range.
78.
How can you concatenate two NumPy arrays
arr1 and arr2 along the second axis?
Answer: Option
Explanation:
The
np.concatenate() function can be used to concatenate arrays along a specified axis.
79.
What does the expression
np.eye(4, k=1) generate?Answer: Option
Explanation:
The
np.eye() function generates an identity matrix with ones on the main diagonal, and the k parameter shifts the diagonal.
80.
How can you calculate the element-wise product of two NumPy arrays
arr1 and arr2?
Answer: Option
Explanation:
The
* operator performs element-wise multiplication of two arrays.
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers