55 most important Python Numpy mcq questions and answers

Python Numpy mcq questions and answers

mcq on numpy in python, mcq on numpy and pandas, python numpy mcq, python numpy multiple choice questions, numpy python mcqs, python numpy mcq questions, numpy mcq questions, numpy mcq questions and answers, numpy mcqs, numpy array mcq, numpy 100 mcqs, numpy and pandas mcq,
Python Numpy mcq questions and answers pdf

55 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, adding 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 mcq on Pandas and Python mcq questions and PySpark.

Q.1. NumPY stands for?
A : Numbering Python
B : Number In Python
C : Numerical Python
D : None Of the above

Numerical Python

Q.2. NumPy is often used along with packages like?
A : Node.js
B : Matplotlib
C : SciPy
D : Both B and C

Advertisement

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

ndarray

4. What will be output for the following code?

import numpy as np
a = np.array([1,2,3])
print a
Q.

A : [[1, 2, 3]]
B : [1]
C : [1, 2, 3]
D : Error

Advertisement

[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]

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

Advertisement

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

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)

Advertisement

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

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

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

Advertisement

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

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)

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

Advertisement

[[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)

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

Advertisement

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.

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

settercall

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’]
Q.

A : [[10 20 30]]
B : [10 20 30]
C : [10]
D : Error

Advertisement

[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)

(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

Advertisement

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

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

Advertisement

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

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

Advertisement

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

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

Advertisement

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

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 above

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 above

Advertisement

all of above

Python multiple choice 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

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

Advertisement

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

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

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

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

Advertisement

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()

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

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)

Advertisement

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()

By reshape()

PySpark mcq questions

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

list(array)

Q.42. How we can find the type of numpy array in python ?
A : dtype
B : type
C : typei
D : itype

Advertisement

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

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

Yes

Q.45. Minimum number of argument to pass in full() function in Numpy array ?
A : 0
B : 1
C : 2
D : 3

Advertisement

2

Q..46 Numpy in the Python provides the
A : Function
B : Lambda function
C : Type casting
D : Array

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

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

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

Advertisement

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

To make a Matrix with all element 0

Data Science mcq questions and answers

Q.51. Which of the following argument we need to pass in reshape() function?
A : Array
B : Shape
C : only array
D : Both array and shape

Both array and shape

Q.52. Which of the following counts the number of elements in Numpy array ?
A : count()
B : return()
C : shape()
D : size()

Advertisement

size()

Q.53. Which of the following find the maximum number in the Numpy array ?
A : max(array)
B : array.max()
C : array(max)
D : None of the above

array.max()

Q.54. Which of the following is correct way to import the Numpy module in your program ?
A : import numpy
B : import numpy as np
C : from numpy import *
D : All of the above

Advertisement

All of the above

Q.55. Which of the following is not valid to import the numpy module ?
A : import numpy as np
B : import numpy as n
C : import numpy as p
D : None of the above

None of the above

Q.56. Which of the following is the essential argument to pass in full() function of Numpy array ?
A : shape
B : value
C : Both of the above
D : None of the above

Both of the above

Q.57. Which of the following is used to convert the list data type to the Numpy array ?
A : array(list)
B : array.list
C : Numpy.array(list)
D : None of the above

Numpy.array(list)

Q.58. Which of the following keyword is used to access the numpy module in python ?
A : access
B : import
C : fetch
D : from

Advertisement

import

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top