Top 100 Python NumPy MCQs with Answers

NumPy is one of the most important Python libraries for numerical computing and data analysis. It is widely used in data science, machine learning, and backend development to handle arrays, matrices, and mathematical operations efficiently.

These 100 Python NumPy MCQs are designed to test your understanding of core NumPy concepts. These questions are frequently asked in interviews and exams, and also help you strengthen your fundamentals and improve problem-solving skills.

100 Python NumPy MCQs with Answers

Q1. Which command is used to import the NumPy library in Python?

A. import numpy
B. import numpy as np
C. import np
D. from numpy import *

Show Answer

Answer: B
The standard convention to import NumPy is using the alias ‘np’ to keep code concise.

Q2. What is the correct way to create a NumPy array from a Python list?

A. np.array([1, 2, 3])
B. numpy.create([1, 2, 3])
C. np.list([1, 2, 3])
D. array([1, 2, 3])

Show Answer

Answer: A
The np.array() function converts a Python list or tuple into a NumPy array object.

Q3. Which attribute is used to find the number of dimensions in a NumPy array?

A. np.ndim
B. .shape
C. .ndim
D. .dim

Show Answer

Answer: C
The .ndim attribute returns an integer representing the number of array dimensions (axes).

Q4. How do you determine the total number of elements in a NumPy array?

A. .size
B. .length
C. .count
D. .total

Show Answer

Answer: A
The .size attribute returns the total count of elements present in the array.

Q5. Which function is used to create an array filled with zeros?

A. np.zeros()
B. np.empty()
C. np.nulls()
D. np.zeros_array()

Show Answer

Answer: A
np.zeros() returns a new array of given shape and type, filled with zeros.

Q6. What is the output of np.arange(0, 10, 2)?

A. [0, 2, 4, 6, 8]
B. [0, 2, 4, 6, 8, 10]
C. [2, 4, 6, 8]
D. [0, 1, 2, 3, 4]

Show Answer

Answer: A
np.arange(start, stop, step) generates values from start up to but not including stop, with the defined step.

Q7. Which function generates an array of evenly spaced numbers over a specified interval?

A. np.arange()
B. np.linspace()
C. np.logspace()
D. np.interval()

Show Answer

Answer: B
np.linspace() returns evenly spaced numbers over a specified interval, where you specify the count of items.

Q8. What is the purpose of the .reshape() method in NumPy?

A. To change the data type of elements
B. To sort the array elements
C. To change the shape of an array without changing its data
D. To flatten the array

Show Answer

Answer: C
.reshape() gives a new shape to an array without changing the data it contains.

Q9. Which function creates an identity matrix?

A. np.identity()
B. np.eye()
C. Both A and B
D. np.matrix()

Show Answer

Answer: C
Both np.identity() and np.eye() can be used to create an identity matrix (square array with ones on the diagonal).

Q10. How do you check the data type of elements in a NumPy array?

A. .type
B. .dtype
C. .datatype
D. .info

Show Answer

Answer: B
The .dtype attribute returns the data type object of the array elements.

Q11. What does the np.ones() function return?

A. An array filled with random numbers
B. An array filled with zeros
C. An array filled with ones
D. An empty array

Show Answer

Answer: C
np.ones() returns a new array of a given shape and type, filled with ones.

Q12. Which function is used to create an array with random values between 0 and 1?

A. np.random.rand()
B. np.random.randint()
C. np.random.randn()
D. np.random.sample()

Show Answer

Answer: A
np.random.rand() creates an array of the given shape and populates it with random samples from a uniform distribution over [0, 1).

Q13. What is the result of np.sqrt([4, 9, 16])?

A. [2, 3, 4]
B. [16, 81, 256]
C. [4, 9, 16]
D. Error

Show Answer

Answer: A
np.sqrt() is a universal function (ufunc) that calculates the non-negative square root of an array, element-wise.

Q14. Which method flattens a multi-dimensional array into a 1-D array?

A. .flatten()
B. .flat()
C. .ravel()
D. Both A and C

Show Answer

Answer: D
Both .flatten() and .ravel() return a flattened 1-D array, though flatten returns a copy while ravel returns a view when possible.

Q15. How is broadcasting defined in NumPy?

A. Sending array data over a network
B. The ability to perform arithmetic operations on arrays of different shapes
C. Converting arrays to audio signals
D. Displaying array output to the console

Show Answer

Answer: B
Broadcasting describes how NumPy treats arrays with different shapes during arithmetic operations.

Q16. Which function stacks arrays vertically?

A. np.hstack()
B. np.vstack()
C. np.stack()
D. np.concatenate()

Show Answer

Answer: B
np.vstack() joins arrays vertically (row-wise) along the first axis.

Q17. What is the correct syntax to perform matrix multiplication?

A. np.dot(A, B)
B. A * B
C. np.multiply(A, B)
D. np.cross(A, B)

Show Answer

Answer: A
np.dot() performs matrix multiplication, whereas * performs element-wise multiplication.

Q18. Which function splits an array into multiple sub-arrays?

A. np.split()
B. np.divide()
C. np.break()
D. np.cut()

Show Answer

Answer: A
np.split() divides an array into multiple sub-arrays along a given axis.

Q19. What does the np.argmax() function return?

A. The maximum value in the array
B. The index of the maximum value
C. The average of the maximum values
D. A boolean array indicating max values

Show Answer

Answer: B
np.argmax() returns the indices of the maximum values along an axis.

Q20. How do you calculate the mean of a NumPy array ‘arr’?

A. arr.mean()
B. np.mean(arr)
C. arr.average()
D. Both A and B

Show Answer

Answer: D
You can compute the mean using either the method arr.mean() or the function np.mean(arr).

Q21. Which function is used to save a NumPy array to a file?

A. np.save()
B. np.write()
C. np.dump()
D. np.export()

Show Answer

Answer: A
np.save() saves an array to a binary file in NumPy .npy format.

Q22. What is the output of arr[1:3] if arr = [10, 20, 30, 40, 50]?

A. [20, 30]
B. [10, 20]
C. [20, 30, 40]
D. [30, 40]

Show Answer

Answer: A
Slicing 1:3 selects elements starting from index 1 up to, but not including, index 3.

Q23. Which NumPy function performs element-wise comparison?

A. np.compare()
B. np.equal()
C. np.diff()
D. np.match()

Show Answer

Answer: B
np.equal() checks element-wise equality and returns a boolean array result.

Q24. What attribute returns the shape of a NumPy array?

A. .shape
B. .form
C. .structure
D. .layout

Show Answer

Answer: A
The .shape attribute returns a tuple representing the array dimensions (rows, columns).

Q25. Which function creates an array without initializing entries?

A. np.empty()
B. np.zeros()
C. np.none()
D. np.blank()

Show Answer

Answer: A
np.empty() returns a new array of given shape and type, without initializing entries to any value.

Q26. How do you transpose a NumPy array ‘arr’?

A. arr.T
B. np.transpose(arr)
C. arr.transpose()
D. All of the above

Show Answer

Answer: D
All three methods (arr.T, np.transpose(arr), and arr.transpose()) can be used to transpose an array.

Q27. What does np.concatenate() do?

A. Joins arrays along an existing axis
B. Joins arrays along a new axis
C. Splits arrays
D. Deletes elements from arrays

Show Answer

Answer: A
np.concatenate() joins a sequence of arrays along an existing axis (default is axis 0).

Q28. Which function returns the standard deviation of array elements?

A. np.std()
B. np.var()
C. np.deviation()
D. np.mean()

Show Answer

Answer: A
np.std() calculates the standard deviation, a measure of the spread of the data.

Q29. How do you find unique elements in a NumPy array?

A. np.unique()
B. np.distinct()
C. np.deduplicate()
D. np.single()

Show Answer

Answer: A
np.unique() finds the unique elements of an array and returns them in sorted order.

Q30. What is the function of np.argsort()?

A. Sorts the array directly
B. Returns the indices that would sort the array
C. Removes duplicate indices
D. Reverses the array order

Show Answer

Answer: B
np.argsort() performs an indirect sort and returns an array of indices that would sort the array.

Q31. Which method creates a copy of the array?

A. .copy()
B. .clone()
C. .view()
D. .duplicate()

Show Answer

Answer: A
The .copy() method creates a deep copy of the array, meaning modifications to the copy do not affect the original.

Q32. What is the result of arr * 2 if arr contains integers?

A. Each element is multiplied by 2
B. The array is repeated twice
C. A syntax error occurs
D. Only the first element changes

Show Answer

Answer: A
NumPy supports vectorization, so scalar multiplication applies the operation to every element.

Q33. Which function returns the determinant of a square matrix?

A. np.linalg.det()
B. np.linalg.inv()
C. np.linalg.eig()
D. np.determinant()

Show Answer

Answer: A
np.linalg.det() calculates the determinant of a square array.

Q34. How do you create a 3×3 array with random integers between 1 and 10?

A. np.random.randint(1, 10, (3, 3))
B. np.random.rand(3, 3)
C. np.random.random(3, 3)
D. np.random.integers(1, 10, (3, 3))

Show Answer

Answer: A
np.random.randint(low, high, size) returns random integers from low (inclusive) to high (exclusive).

Q35. Which function computes the inverse of a matrix?

A. np.linalg.inv()
B. np.linalg.det()
C. np.linalg.solve()
D. np.linalg.matrix_inverse()

Show Answer

Answer: A
np.linalg.inv() computes the multiplicative inverse of a matrix.

Q36. What does axis=0 typically represent in a 2D NumPy array operation?

A. Operation along columns
B. Operation along rows
C. Operation across the depth
D. Flattening the array

Show Answer

Answer: A
In a 2D array, axis=0 refers to vertical operations (down rows), effectively aggregating columns.

Q37. Which function is used to delete elements from an array?

A. np.delete()
B. np.remove()
C. np.drop()
D. np.cut()

Show Answer

Answer: A
np.delete() returns a new array with sub-arrays along an axis deleted.

Q38. What is the default data type (dtype) for np.zeros()?

A. int
B. float
C. str
D. bool

Show Answer

Answer: B
The default data type for functions like np.zeros and np.ones is float (usually float64).

Q39. How do you calculate the dot product of two vectors a and b?

A. a * b
B. np.dot(a, b)
C. np.cross(a, b)
D. np.multiply(a, b)

Show Answer

Answer: B
np.dot(a, b) handles dot products for vectors and matrix multiplication for 2-D arrays.

Q40. What does the np.newaxis keyword do?

A. Creates a new array
B. Increases the dimension of an existing array by one
C. Deletes a dimension
D. Renames the array

Show Answer

Answer: B
np.newaxis is used to increase the dimension of the existing array by one more dimension.

Q41. Which function stacks arrays horizontally?

A. np.vstack()
B. np.hstack()
C. np.dstack()
D. np.stack()

Show Answer

Answer: B
np.hstack() stacks arrays in sequence horizontally (column-wise).

Q42. How do you find the index of the minimum value in an array?

A. np.argmin()
B. np.min()
C. np.minimum()
D. np.find_min()

Show Answer

Answer: A
np.argmin() returns the index of the minimum value in the array.

Q43. What is the result of np.sum([[0, 1], [0, 5]], axis=1)?

A. [1, 5]
B. [0, 6]
C. [1, 5, 0, 0]
D. 6

Show Answer

Answer: A
axis=1 sums across columns for each row, resulting in [0+1, 0+5].

Q44. Which NumPy function calculates the exponential of all elements in the input array?

A. np.exp()
B. np.power()
C. np.log()
D. np.sqrt()

Show Answer

Answer: A
np.exp() calculates the exponential (e^x) of all elements in the array.

Q45. How is a View different from a Copy in NumPy?

A. A copy creates a new object, while a view is just a reference to the original data
B. A view creates a new object, while a copy is a reference
C. Both are identical in memory usage
D. Copies are faster than views

Show Answer

Answer: A
A view does not own the data and changes to it affect the original array, while a copy is an independent new array.

Q46. Which function is used to insert values into an array?

A. np.insert()
B. np.append()
C. np.add()
D. np.extend()

Show Answer

Answer: A
np.insert() inserts values along the given axis before the given indices.

Q47. What is the function of np.clip()?

A. Cuts the array into pieces
B. Limits the values in an array to a range
C. Removes outliers
D. Copies array elements

Show Answer

Answer: B
np.clip(a, a_min, a_max) replaces values less than a_min with a_min and greater than a_max with a_max.

Q48. Which function computes the eigenvalues and right eigenvectors of a square array?

A. np.linalg.eig()
B. np.linalg.eigvals()
C. np.linalg.svd()
D. np.linalg.qr()

Show Answer

Answer: A
np.linalg.eig() returns the eigenvalues and eigenvectors of a square matrix.

Q49. What does np.full((2, 2), 7) create?

A. A 2×2 array filled with 7s
B. A 2×2 array of random 7s
C. A 2×2 array of zeros
D. A 7×7 array of twos

Show Answer

Answer: A
np.full(shape, fill_value) creates an array of the given shape filled with the specified value.

Q50. How do you sort a NumPy array?

A. arr.sort()
B. np.sort(arr)
C. sorted(arr)
D. Both A and B

Show Answer

Answer: D
arr.sort() sorts the array in-place, while np.sort(arr) returns a sorted copy.

Q51. What does np.nan represent?

A. Not a Number
B. Null value
C. Zero
D. Infinite value

Show Answer

Answer: A
np.nan is a special floating-point value representing “Not a Number,” often used for missing data.

Q52. Which function returns the cumulative sum of the elements?

A. np.sum()
B. np.cumsum()
C. np.add.accumulate()
D. Both B and C

Show Answer

Answer: D
np.cumsum() returns the cumulative sum as an array, similar to np.add.accumulate().

Q53. How do you convert a NumPy array to a Python list?

A. arr.tolist()
B. list(arr)
C. np.list(arr)
D. Both A and B

Show Answer

Answer: A
The .tolist() method converts the NumPy array into a nested Python list.

Q54. Which function creates a diagonal matrix from an array?

A. np.diag()
B. np.diagonal()
C. np.eye()
D. np.trace()

Show Answer

Answer: A
np.diag() can extract the diagonal or construct a diagonal array depending on the input.

Q55. What is the output of np.array([1, 2, 3]) * np.array([4, 5, 6])?

A. [4, 10, 18]
B. 32
C. [5, 7, 9]
D. Error

Show Answer

Answer: A
The * operator performs element-wise multiplication on NumPy arrays.

Q56. Which function compares two arrays element-wise and returns the greater value?

A. np.maximum()
B. np.max()
C. np.greater()
D. np.compare()

Show Answer

Answer: A
np.maximum() compares two arrays element-wise and returns a new array containing the element-wise maxima.

Q57. What function returns the variance of array elements?

A. np.var()
B. np.std()
C. np.mean()
D. np.diff()

Show Answer

Answer: A
np.var() calculates the variance, which is the average of the squared differences from the Mean.

Q58. How do you find the indices where elements should be inserted to maintain order?

A. np.searchsorted()
B. np.sort()
C. np.where()
D. np.argsort()

Show Answer

Answer: A
np.searchsorted() finds indices into a sorted array such that inserting elements maintains the sorted order.

Q59. Which function returns the product of array elements?

A. np.prod()
B. np.product()
C. np.multiply()
D. np.multi()

Show Answer

Answer: A
np.prod() returns the product of array elements over a given axis.

Q60. What does np.floor() do?

A. Rounds down to the nearest integer
B. Rounds up to the nearest integer
C. Rounds to the nearest integer
D. Truncates the decimal part

Show Answer

Answer: A
np.floor() returns the floor of the input, element-wise, which is the largest integer less than or equal to the value.

Q61. Which function is used for element-wise absolute value?

A. np.abs()
B. np.absolute()
C. np.mod()
D. Both A and B

Show Answer

Answer: D
Both np.abs() and np.absolute() calculate the absolute value element-wise.

Q62. What does the np.diff() function compute?

A. The difference between consecutive elements
B. The difference between max and min
C. The derivative of the array
D. The logical difference

Show Answer

Answer: A
np.diff() calculates the first discrete difference (arr[i+1] – arr[i]) along the given axis.

Q63. How do you check if any element in an array evaluates to True?

A. np.any()
B. np.all()
C. np.check()
D. np.contains()

Show Answer

Answer: A
np.any() returns True if any element of the array evaluates to True.

Q64. How do you check if all elements in an array evaluate to True?

A. np.any()
B. np.all()
C. np.every()
D. np.check_all()

Show Answer

Answer: B
np.all() returns True only if all elements evaluate to True.

Q65. What is the function of np.squeeze()?

A. Removes single-dimensional entries from the shape
B. Compresses the array size
C. Squeezes data into a smaller dtype
D. Joins arrays together

Show Answer

Answer: A
np.squeeze() removes axes of length one from the shape of the input array.

Q66. Which function generates random numbers from a standard normal distribution?

A. np.random.rand()
B. np.random.randn()
C. np.random.normal()
D. Both B and C

Show Answer

Answer: D
np.random.randn() returns samples from the standard normal distribution, while normal() allows parameter customization.

Q67. How do you save a NumPy array to a text file?

A. np.save()
B. np.savetxt()
C. np.savez()
D. np.dump()

Show Answer

Answer: B
np.savetxt() saves an array to a text file, while np.save() handles binary .npy files.

Q68. Which function constructs an array by repeating A the number of times given by reps?

A. np.repeat()
B. np.tile()
C. np.duplicate()
D. np.broadcast()

Show Answer

Answer: B
np.tile() creates an array by repeating the input array the number of times specified by reps.

Q69. What is the difference between np.repeat() and np.tile()?

A. Repeat repeats elements, tile repeats the whole array
B. Tile repeats elements, repeat repeats the array
C. Both function identically
D. Repeat works on 1D, tile works on 2D only

Show Answer

Answer: A
np.repeat() repeats individual elements, while np.tile() repeats the entire array structure as a block.

Q70. Which function returns the percentile of data in an array?

A. np.percentile()
B. np.quantile()
C. np.median()
D. Both A and B

Show Answer

Answer: D
np.percentile() computes the q-th percentile, while np.quantile() is similar but takes values in [0, 1].

Q71. How do you calculate the median of an array?

A. np.median()
B. np.average()
C. np.mean()
D. np.center()

Show Answer

Answer: A
np.median() computes the median (middle value) of the array elements.

Q72. Which function returns the indices of non-zero elements?

A. np.nonzero()
B. np.where()
C. np.find()
D. Both A and B

Show Answer

Answer: A
np.nonzero() returns a tuple of indices where the array elements are non-zero.

Q73. What is the function of np.round()?

A. Rounds an array to the given number of decimals
B. Rounds to the nearest integer only
C. Removes decimals
D. Calculates the circumference

Show Answer

Answer: A
np.round() rounds array elements to the specified number of decimal places.

Q74. How do you perform linear algebra operations like solving linear equations?

A. np.linalg.solve()
B. np.solve()
C. np.linalg.det()
D. np.calculus()

Show Answer

Answer: A
np.linalg.solve() solves a linear matrix equation, or system of linear scalar equations.

Q75. What does np.trace() compute?

A. The sum along diagonals of the array
B. The sum of all elements
C. The determinant
D. The shape of the array

Show Answer

Answer: A
np.trace() returns the sum along diagonals of the array.

Q76. Which function checks if two arrays are element-wise equal within a tolerance?

A. np.array_equal()
B. np.allclose()
C. np.equal()
D. np.compare()

Show Answer

Answer: B
np.allclose() returns True if two arrays are element-wise equal within a specified tolerance.

Q77. How do you extract the diagonal elements of a matrix?

A. np.diag()
B. np.diagonal()
C. np.trace()
D. Both A and B

Show Answer

Answer: D
Both np.diag() and np.diagonal() can be used to extract the diagonal elements of a matrix.

Q78. Which function returns the inner product of two vectors?

A. np.inner()
B. np.dot()
C. np.outer()
D. Both A and B

Show Answer

Answer: D
For 1-D arrays, both np.inner() and np.dot() return the scalar inner product.

Q79. What does np.outer() compute?

A. Outer product of two vectors
B. Inner product
C. Matrix multiplication
D. Cross product

Show Answer

Answer: A
np.outer() computes the outer product of two vectors, resulting in a matrix.

Q80. Which method adds a scalar value to every element of the array?

A. np.add()
B. + operator
C. arr.add()
D. Both A and B

Show Answer

Answer: D
Both the + operator and np.add() perform element-wise addition with broadcasting.

Q81. What is the purpose of np.where()?

A. To return indices where a condition is true
B. To replace elements based on a condition
C. To find a specific value
D. Both A and B

Show Answer

Answer: D
np.where(condition) returns indices, and np.where(condition, x, y) returns elements from x or y based on the condition.

Q82. How do you calculate the dot product of two matrices?

A. np.matmul()
B. @ operator
C. np.dot()
D. All of the above

Show Answer

Answer: D
In modern Python/NumPy, np.matmul, the @ operator, and np.dot are all valid for matrix multiplication.

Q83. Which function creates an array of a specified shape and type, filled with fill_value?

A. np.full()
B. np.fill()
C. np.ones()
D. np.empty()

Show Answer

Answer: A
np.full(shape, fill_value) creates an array of the given shape initialized with the specified value.

Q84. What does np.logical_and() do?

A. Computes the logical AND operation element-wise
B. Computes the bitwise AND
C. Checks if both arrays are equal
D. Returns the minimum of two arrays

Show Answer

Answer: A
np.logical_and() computes the truth value of x1 AND x2 element-wise.

Q85. How do you swap two axes of an array?

A. np.swapaxes()
B. np.moveaxis()
C. np.rollaxis()
D. arr.swap()

Show Answer

Answer: A
np.swapaxes() interchanges two axes of an array.

Q86. Which function returns the arithmetic mean along the specified axis?

A. np.mean()
B. np.average()
C. np.median()
D. np.mode()

Show Answer

Answer: A
np.mean() calculates the arithmetic mean, while np.average() can handle weighted averages.

Q87. What is the output of np.ceil([-1.7, 1.5, -0.2])?

A. [-1., 2., -0.]
B. [-2., 1., -1.]
C. [-1., 1., 0.]
D. [-2., 2., 0.]

Show Answer

Answer: A
np.ceil() returns the ceiling of the input, element-wise, which is the smallest integer greater than or equal to the value.

Q88. Which function constructs an open mesh from multiple sequences?

A. np.meshgrid()
B. np.ogrid()
C. np.mgrid()
D. np.ix_()

Show Answer

Answer: B
np.ogrid() returns open multi-dimensional “meshgrid” arrays, which are memory-efficient compared to meshgrid.

Q89. How do you get the number of bytes occupied by an array?

A. .nbytes
B. .size
C. .itemsize
D. .memory()

Show Answer

Answer: A
The .nbytes attribute returns the total bytes consumed by the elements of the array.

Q90. What is the function of np.histogram()?

A. Computes the histogram of a set of data
B. Creates a bar chart
C. Calculates frequency
D. Sorts data into bins

Show Answer

Answer: A
np.histogram() computes the histogram of a set of data, returning the frequency counts and bin edges.

Q91. Which function is used to append values to the end of an array?

A. np.append()
B. np.insert()
C. np.extend()
D. np.add()

Show Answer

Answer: A
np.append() adds values to the end of an array, creating a copy of the original array.

Q92. What does np.itemsize return?

A. Total size of the array in bytes
B. Length of one array element in bytes
C. Number of elements
D. Size of the shape tuple

Show Answer

Answer: B
The .itemsize attribute returns the length of one array element in bytes (e.g., 4 for float32).

Q93. Which function returns a contiguous flattened array?

A. np.ravel()
B. np.flatten()
C. np.flat()
D. np.contiguous()

Show Answer

Answer: A
np.ravel() returns a contiguous flattened array (1-D view or copy) of the input.

Q94. How do you generate a random permutation of a sequence?

A. np.random.permutation()
B. np.random.shuffle()
C. np.random.permute()
D. np.random.order()

Show Answer

Answer: A
np.random.permutation() returns a permuted sequence or range (returns a copy), whereas shuffle modifies in-place.

Q95. What is the result of np.array([1, 2, 3], dtype=’float’)?

A. [1., 2., 3.]
B. [1, 2, 3]
C. Error
D. [‘1’, ‘2’, ‘3’]

Show Answer

Answer: A
Specifying dtype=’float’ converts the integer elements into floating point numbers.

Q96. Which function splits an array into multiple sub-arrays vertically?

A. np.hsplit()
B. np.vsplit()
C. np.dsplit()
D. np.split()

Show Answer

Answer: B
np.vsplit() is a convenience function for splitting arrays vertically (along axis 0).

Q97. How do you create a NumPy array of complex numbers?

A. np.array([1, 2], dtype=complex)
B. np.complex([1, 2])
C. np.array([1+0j, 2+0j])
D. Both A and C

Show Answer

Answer: D
You can either define the complex numbers explicitly or use the dtype=complex argument.

Q98. Which function returns the reciprocal of the argument, element-wise?

A. np.reciprocal()
B. np.divide()
C. np.inverse()
D. np.recip()

Show Answer

Answer: A
np.reciprocal() calculates the reciprocal (1/x) of each element in the array.

Q99. What does np.sign() return?

A. An indication of the sign of a number (-1, 0, 1)
B. The signature of the function
C. The mathematical sign function
D. Both A and C

Show Answer

Answer: D
np.sign() returns an array of the same shape indicating the sign of each element (-1 for negative, 0 for zero, 1 for positive).

Q100. Which function is an alias for np.row_stack?

A. np.vstack
B. np.hstack
C. np.column_stack
D. np.concatenate

Show Answer

Answer: A
np.vstack is equivalent to np.row_stack, both stacking arrays vertically.

Conclusion

That’s it for this 100 Python NumPy MCQs question bank! If you get stuck on any question or answer, simply paste it into AI chatbots like ChatGPT or Gemini and ask for a detailed explanation. Once you understand the logic behind an answer, you will never ever forget it.

If you are new to NumPy, it’s important to first build a strong foundation and then move towards advanced concepts step by step. AskPython has a complete collection of NumPy tutorials that you can follow in sequence.

Start with these beginner-friendly guides:

Once you are comfortable, move to intermediate topics:

Then explore more advanced concepts:

Also, make sure to bookmark this page for later revision. Just press Ctrl + D on Windows or Cmd + D on Mac so you can easily revisit these Python NumPy MCQs anytime you need.

Aditya Gupta
Aditya Gupta
Articles: 14