50 Most important Python Numpy MCQ Questions and Answers 2023

50 most important Python Numpy MCQ questions and answers are given below. These Numpy multiple choice questions include both theory and coding questions based on Numpy. We are also planning to add Numpy MCQ Questions and Answers PDF download link.
NumPy is a library for the Python programming language, which adds support for large, multi-dimensional arrays and matrices, along with a large collection of high-level mathematical functions to operate on these arrays. We have added pandas and python mcq questions and mcqs on pyspark.
Python Numpy mcq questions and answers 2023
Q.1. NumPY stands for?
A : Numbering Python
B : Number In Python
C : Numerical Python
D : None Of the above
Ans:- Numerical Python
Q.2. NumPy is often used along with packages like?
A : Node.js
B : Matplotlib
C : SciPy
D : Both B and C
Ans:- Both B and C
Q.3. The most important object defined in NumPy is an N-dimensional array type called?
A : ndarray
B : narray
C : nd_array
D : darray
Ans:- ndarray
4. What will be output for the following code?
import numpy as np
a = np.array([1,2,3])
print a
A : [[1, 2, 3]]
B : [1]
C : [1, 2, 3]
D : Error
Ans:- [1, 2, 3]
5. What will be output for the following code?
import numpy as np
a = np.array([1, 2, 3], dtype = complex)
print a
Q.
A : [[ 1.+0.j, 2.+0.j, 3.+0.j]]
B : [ 1.+0.j]
C : Error
D : [ 1.+0.j, 2.+0.j, 3.+0.j]
Ans:- [[ 1.+0.j, 2.+0.j, 3.+0.j]]
Q.6. Which of the following statement is false?
A : ndarray is also known as the axis array.
B : ndarray.dataitemSize is the buffer containing the actual elements of the array.
C : NumPy main object is the homogeneous multidimensional array
D : In Numpy, dimensions are called axes
Ans:- ndarray is also known as the axis array.
Q.7. If a dimension is given as ____ in a reshaping operation, the other dimensions are automatically calculated.
A : Zero
B : One
C : Negative one
D : Infinite
Ans:- Negative one
Q.8. Which of the following sets the size of the buffer used in ufuncs?
A : bufsize(size)
B : setsize(size)
C : setbufsize(size)
D : size(size)
Ans:- setbufsize(size)
9. What will be output for the following code?
import numpy as np
dt = dt = np.dtype(‘i4’)
print dt
Q.
A : int32
B : int64
C : int128
D : int16
Ans:- int32
Q.10. Each built-in data type has a character code that uniquely identifies it.What is meaning of code “M”?
A : timedelta
B : datetime
C : objects
D : Unicode
Ans:- datetime
Numpy multiple choice questions and answers
Q.11. Numpy developed by?
A : Guido van Rosum
B : Travis Oliphant
C : Wes McKinney
D : Jim Hugunin
Ans:-Travis Oliphant
Q.12. Which of the following Numpy operation are correct?
A : Mathematical and logical operations on arrays.
B : Fourier transforms and routines for shape manipulation.
C : Operations related to linear algebra.
D : All of the above
Ans:- All of the above
Q.13. The basic ndarray is created using?
A : numpy.array(object, dtype = None, copy = True, subok = False, ndmin = 0)
B : numpy.array(object, dtype = None, copy = True, order = None, subok = False, ndmin = 0)
C : numpy_array(object, dtype = None, copy = True, order = None, subok = False, ndmin = 0)
D : numpy.array(object, dtype = None, copy = True, order = None, ndmin = 0)
Ans:- numpy.array(object, dtype = None, copy = True, order = None, subok = False, ndmin = 0)
14. What will be output for the following code?
import numpy as np
a = np.array([1, 2, 3,4,5], ndmin = 2)
print a
Q.
A : [[1, 2, 3, 4, 5]]
B : [1, 2, 3, 4, 5]
C : Error
D : Null
Ans:- [[1, 2, 3, 4, 5]]
Q.15. What is the syntax for dtype object?
A : numpy.dtype(object, align, copy, subok)
B : numpy.dtype(object, align, copy)
C : numpy.dtype(object, align, copy, ndmin)
D : numpy_dtype(object, align, copy)
Ans:- numpy.dtype(object, align, copy)
Pandas mcq questions and answers
Q.16. Which of the following function stacks 1D arrays as columns into a 2D array?
A : row_stack
B : column_stack
C : com_stack
D : All of the above
Ans:- column_stack
Q.17. Which of the following statement is true?
A : Some ufuncs can take output arguments.
B : Broadcasting is used throughout NumPy to decide how to handle disparately shaped arrays
C : Many of the built-in functions are implemented in compiled C code
D : The array object returned by __array_prepare__ is passed to the ufunc for computation.
Ans:- The array object returned by __array_prepare__ is passed to the ufunc for computation.
Q.18. Which of the following set the floating-point error callback function or log object?
A : settercall
B : setterstack
C : setter
D : callstack
Ans:- settercall
Q.19. What will be output for the following code?
import numpy as np
dt = np.dtype([(‘age’,np.int8)])
a = np.array([(10,),(20,),(30,)], dtype = dt)
print a[‘age’]
A : [[10 20 30]]
B : [10 20 30]
C : [10]
D : Error
Ans:- [10 20 30]
Q.20. What is the range of uint32 data type?
A : (-2147483648 to 2147483647)
B : (-32768 to 32767)
C : (0 to 65535)
D : (0 to 4294967295)
Ans:- (0 to 4294967295)
NUMPY and Pandas mcq questions
Q.21. What will be printed?
import numpy as np
a = np.array([1,2,3,5,8])
b = np.array([0,3,4,2,1])
c = a + b
c = c*a
print (c[2])
A : 7
B : 12
C : 10
D : 21
Ans:- 21
Q.22. What will be output for the following code?
import numpy as np
ary = np.array([1,2,3,5,8])
ary = ary + 1
print (ary[1])
A : 0
B : 1
C : 2
D : 3
Ans:- 3
Q.23. What will be output for the following code?
import numpy as np
a = np.array([[1,2,3],[0,1,4]])
print (a.size)
A : 1
B : 5
C : 6
D : 4
Ans:- 6
Q.24. What will be output for the following code?
import numpy as np
a = np.array([1,2,3,5,8])
print (a.ndim)
A : 0
B : 1
C : 2
D : 3
Ans:- 1
Q.25. What will be output for the following code?
import numpy as np
a = np.array([[1,2,3],[0,1,4]])
b = np.zeros((2,3), dtype=np.int16)
c = np.ones((2,3), dtype=np.int16)
d = a + b + c
print (d[1,2] )
A : 5
B : 7
C : 3
D : 4
Ans:- 5
Q.26. What is the correct code to install numpy in the linux system containing python3?
A : pip numpy install python3
B : pip3 install numpy
C : pip install numpy
D : python3 pip3 numpy install
Ans:- pip3 install numpy
Q.27. What is the correct code to install numpy in the windows system containing python3?
A : pip3 install numpy
B : pip install numpy
C : python3 install numpy
D : none of above
Ans:- pip install numpy
Q.28. fetch numpy as np
np.array(list)
Is it true to import numpy module like this?
A : Yes, true
B : Syntax Error
Ans:- Syntax Error
Q.29. import numpy as np
np.array(list)
Is it true to import numpy module like this?
A : Yes, true
B : Not, true
C : Syntax Error
D : All of aboveShow Answer
Ans:- Yes, true
Q.30. How to import numpy module?
A : from numpy import *
B : import numpy
C : import numpy as my_numpy
D : import numpy as np
E : all of aboveShow Answer
Ans:- all of above
Python multiple choice questions and answers Python Numpy mcq questions and answers
Q.31. What is zero() function in numpy use to?
A : make a matrix with first column 0
B : make a matrix with all elements 0
C : make a matrix with diagonal elements 0
D : All of the above
Ans:- make a matrix with all elements 0
Q.32. What does it do?
array.min()
A : finds the maximum number in numpy array
B : finds the minimum number in numpy array
C : makes operation of minus if x < 100 D : answers B & C
Ans:- finds the minimum number in numpy array
Q.33. Is the following statement true?
numpy array can be converted to the list in python3?
A : false
B : true
C : can’t say
D : None of the above
Ans:- true
Q.34. Choose the true properties of nd-array as.
A : fast and flexible container for large datasets in python
B : Homogeneous data i.e. all of the elements must be the same type
C : None of the above
D : Both A & B
Ans:- Both A & B
Q.35. Regarding creating ndarray, choose the build in functions in numpy.
A : np.array()
B : np.zeros()
C : np.empty()
D : np.arange()
E : All of the above
Ans:- All of the above
Q.36. What are the attributes of numpy array?
A : shape, dtype, ndim
B : objects, type, list
C : objects, non vectorization
D : Unicode and shape
Ans:- shape, dtype, ndim
Q.37. Methods for boolean in numpy array.
Choose the relevant from the following options.
A : sum(), any(), np.type()
B : sum(), any(), all(), np.type()
C : objects(), any()
D : sum(), any(), all()
Ans:- sum(), any(), all()
Q.38. What is Fortran order in numpy?
A : reshaping regarding row major order
B : reshaping regarding column major order
C : converting to 1D array
D : All of the above
Ans:- reshaping regarding column major order
Q.39. Correct syntax of the reshape() function in Numpy array python is
A : array.reshape(shape)
B : reshape(shape,array)
C : reshape(array,shape)
D : reshape(shape)
Ans:- reshape(array,shape)
Q.40. How we can change the shape of the Numpy array in python?
A : By Shape()
B : By reshape()
C : By ord()
D : By change()
Ans:- By reshape()
PySpark mcq questions 2023 Python Numpy mcq questions and answers
Q.41. How we can convert the Numpy array to the list in python?
A : list(array)
B : list.array
C : array.list
D : None of the above
Ans:- list(array)
Q.42. How we can find the type of numpy array in python ?
A : dtype
B : type
C : typei
D : itype
Ans:- dtype
Q.43. How we install Numpy in the system ?
A : install numpy
B : pip install python numpy
C : pip install numpy
D : pip install numpy python
Ans:- pip install numpy
Q.44. It is possible to convert the Numpy array to list in python ?
A : Yes
B : No
C : Sometimes
D : None of the above
Ans:- Yes
Q.45. Minimum number of argument to pass in full() function in Numpy array?
A : 0
B : 1
C : 2
D : 3
Ans:- 2
Q..46 Numpy in the Python provides the
A : Function
B : Lambda function
C : Type casting
D : Array
Ans:- Array
Q.47. Numpy.array(list), what it does?
A : It convert array to list
B : It convert list to array
C : It convert array to array
D : Error
Ans:- It convert list to array
Q.48. Shape() function in Numpy array is used to …….
A : Find the shape of the array
B : Change the shape of the array
C : Both of the above
D : None of the above
Ans:- Find the shape of the array
Q.49. What is the use of the size attribute in Numpy array in python?
A : It find the direction
B : It find the number of items
C : It find the shape
D : All of the above
Ans:- It find the number of items
Q.50. what is the use of the zeros() function in Numpy array in python?
A : To make a Matrix with all element 0
B : To make a Matrix with all diagonal element 0
C : To make a Matrix with first row 0
D : None of the above
Ans:- To make a Matrix with all element 0\
Python Numpy mcq questions and answers