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 does NumPy stand for?

 
 
 
 

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

 
 
 
 

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

 
 
 
 

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

 
 
 
 

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

 
 
 
 

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

 
 
 
 

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

 

 
 
 
 

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

 
 
 
 

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

 
 
 
 

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

 
 
 
 
 

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

 
 
 
 

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

 
 
 
 

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

 
 
 
 

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

 
 
 
 

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

 
 
 
 
 

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

 
 
 
 

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

 
 
 
 
 

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

 
 
 
 

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

 
 
 
 

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

 
 
 
 

Question 1 of 20

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

Python Data Visualization Quiz 10

This Python Data Visualization Quiz focuses on Python’s Matplotlib library, a fundamental tool for data visualization. This Python Quiz tests your understanding of key concepts, functions, and best practices in creating, customizing, and saving plots using Matplotlib. Let us start with the Python Data Visualization Quiz now.

Online Python Data Visualization Quiz with Answers
Please go to Python Data Visualization Quiz 10 to view the test

Online Python Data Visualization Quiz with Answers

  • Which of the following libraries is NOT mentioned as a high-level visualization library?
  • Matplotlib is a widely used Python data visualization library.
  • Which Matplotlib function is used to create histograms?
  • What are some of the key purposes of the Matplotlib library for data visualization?
  • What function in Matplotlib is used to create a basic line plot?
  • Which Matplotlib function would you use to create scatter plots that show the relationship between two arrays?
  • Which of the following are valid ways to create a bar plot in Matplotlib?
  • Which of the following can be created using the Matplotlib library?
  • What is the primary purpose of the Matplotlib library in Python?
  • Matplotlib was created by:
  • What is the code for the Matplotlib magic function?
  • Which two of the following are not examples of Matplotlib magic functions?
  • Which of the following is not a main layer of Matplotlib?
  • Matplotlib was initially developed as what kind of tool?
  • Matplotlib’s three main layers are: Backend, Artist, and Scripting.
  • When plotting directly with Matplotlib, the pyplot module offers a convenient way to create and customize plots quickly.
  • The first step when creating a histogram in matplotlib is to import matplotlib as ———— and its scripting interface as ————–.
  • What is the process of creating a scatter plot?
  • The Python library we used to plot the graphs is ————–.
  • How do you create a scatter plot in Matplotlib?

Statistics and Data Analysis

Python Quiz for Beginners 9

Test your Python basics with this beginner-friendly quiz! The Python Quiz for Beginners covers essential Python data structures like dictionaries (key-value pairs), DataFrames (tabular data, often used with pandas), sets (unordered, unique elements), and tuples (immutable sequences). Whether you are learning Python or refreshing your skills, this Python Quiz for Beginners will help reinforce your understanding of these fundamental concepts. Let us start the Python Quiz for Beginners now.

Online Python Quiz for Beginners with Answers
Please go to Python Quiz for Beginners 9 to view the test

Online Python Quiz for Beginners with Answers

  • How would you access the first row and first column in the DataFrame df?
  • What does the split() method return from a list of words?
  • Given the string Name=”EMILY”, which statement would provide the index of 0?
  • What is the result of the following lines of code? x=1 x = x > -5
  • How would you change the first element to 10 in this array? c = np.array([100,1,2,3,0])
  • What is the output of the following code segment? i=6 i<5
  • What does the following function return? len([‘A’,’B’,1])
  • Which of the following data types should numbers with decimals be if you want to use them as input for training a statistical model? 666, 1.1, 232, 23.12.
  • What data type does the value 1.0 belong to?
  • True or False. What is the output of the code snippet below? ‘a’==‘A’
  • A dictionary must have what type of keys?
  • What Python library serves as a foundation for Pandas and is used for scientific computing?
  • Given the dataframe df, how can you retrieve the element in the first row and first column?
  • In a data set, what term refers to the column name?
  • What is the outcome of the following? ‘1’ in {‘1′,’2’}
  • What Python object do you cast to a data frame?
  • What following code segment would produce an output of “0”?
  • Which method extracts the distinct elements from the following? df[‘Length’]
  • What is the syntax to obtain the first element of the tuple? A=(‘a’,’b’,’c’)
  • What attribute retrieves the number of elements in a numpy array?

Take MS Excel Tables Query Quiz