What does the np.eye() function do in NumPy?
A
Creates a random array
B
Creates an identity matrix
Correct answer
C
Calculates the dot product of two arrays
D
Reshapes an array
Correct answer
B. Creates an identity matrix
15 views
⚔️
Challenge a friend on NumPy
Same MCQs, timed, live leaderboard. Send the link on WhatsApp – no sign-up needed.
Create challenge
Explanation
The np.eye() function creates an identity matrix of the specified size, with ones on the diagonal and zeros elsewhere. This function is commonly used in linear algebra and matrix operations.
Doubts & discussionNot sure why the answer is B? Ask here and get an explanation.
Ask a doubt about this MCQ
‹ Previous MCQ Which function is used to find the unique elements of an array in NumPy? Next MCQ › Which function is used to find the indices of the maximum and minimum elements of an array in NumPy?