Python NumPy MCQs 11

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.

1. 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

 
 
 
 

2. What is the primary purpose of the NumPy library in Python?

 
 
 
 

3. What Python libraries are commonly used for data mining?

 
 
 
 

4. Which of the following operations can be performed on NumPy arrays?

 
 
 
 
 

5. What does np.random.seed(42) do?

 
 
 
 

6. Which is the correct way to create a $2\times2$ NumPy array filled with ones?

 
 
 
 

7. What line of code would produce the following: array([11, 11, 11, 11, 11])?

 
 
 
 

8. What is the output of np.zeros((2,3))?

 
 
 
 

9. 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)

 
 
 
 

10. How do you access the element at the second row and third column of a 2D NumPy array ‘arr’?

 
 
 
 

11. 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

 

 
 
 
 

12. Which function is used to create a NumPy array?

 
 
 
 

13. Which method returns the shape of a NumPy array?

 
 
 
 

14. What does np.arange(5) produce?

 
 
 
 

15. Which of the following statements about creating and manipulating multi-dimensional arrays in Python using NumPy are true?

 
 
 
 
 

16. Which of the following are valid ways to create a NumPy array?

 
 
 
 
 

17. What does NumPy stand for?

 
 
 
 

18. 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]

 
 
 
 

19. 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)

 
 
 
 

20. What result will the following lines of code give?
a=np.array([0,1])
b=np.array([1,0])
np.dot(a,b)

 
 
 
 

Online Python NumPy MCQs with Answers

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?

Islamiat MCQs 9th Class Quiz

Leave a Reply

Discover more from R Programming FAQs

Subscribe now to keep reading and get access to the full archive.

Continue reading