These Python NumPy MCQs are designed to test your understanding of fundamental NumPy concepts, including array creation, manipulation, and common operations. The Python NumPy MCQs Quiz consists of multiple-choice questions (MCQs) covering essential topics such as:
- Array creation (
np.array()
,np.zeros()
,np.arange()
) - Array properties (
.shape
,.size
) - Basic operations (dot product, arithmetic)
- NumPy terminology
Each question is followed by the correct answer, making it useful for self-assessment, interviews, or exam preparation. Whether you are a beginner or an intermediate Python programmer, this Python Quiz helps reinforce key NumPy skills efficiently. Let us start with the Python NumPy MCQs now.
Online Python Numpy MCQs with Answers
- What result will the following lines of code give?
a=np.array([0,1])
b=np.array([1,0]) np.dot(a,b) - What does the value of $Z$ become after executing the following code?
X=np.array([[1,0], [0,1]])
Y=np.array([[0,1], [1,0]])
Z=X+Y Â - If you run the following lines of code, what values will the variable ‘out’ take?
X=np.array([[1,0,1],[2,2,2]])
out=X[0:2,2] - If you run the following lines of code, what values will the variable ‘out’ take?
X=np.array([[1,0], [0,1]])
Y=np.array([[2,2], [2,2]])
Z=np.dot(X,Y) - After executing the given code, what value does $Z$ hold?
X=np.array([[1,0], [0,1]])
Y=np.array([[2,1], [1,2]])
Z=np.dot(X,Y) - What outcome do the following lines of code produce?
a=np.array([0,1,0,1,0])
b=np.array([1,0,1,0,1])
a+b - What line of code would produce the following: array([11, 11, 11, 11, 11])?
- Which is the correct way to create a $2\times2$ NumPy array filled with ones?
- Which of the following are valid ways to create a NumPy array?
- Which of the following operations can be performed on NumPy arrays?
- How do you access the element at the second row and third column of a 2D NumPy array ‘arr’?
- What is the primary purpose of the NumPy library in Python?
- What Python libraries are commonly used for data mining?
- What does NumPy stand for?
- Which of the following statements about creating and manipulating multi-dimensional arrays in Python using NumPy are true?
- Which function is used to create a NumPy array?
- What is the output of np.zeros((2,3))?
- Which method returns the shape of a NumPy array?
- What does np.arange(5) produce?
- What does np.random.seed(42) do?