Numpy Multiple Choice Questions And Answers

Anyone can sharpen their knowledge of Numpy Python library with Numpy multiple choice questions and answers.

MCQs

Question 1:

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

Answer: D

Question 2:

 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

Answer: D

Question 3:

 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

Answer: C

Question 4:

 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

Answer: B

Question 5:

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

Answer: A

Question 6:

 NumPY stands for?

 A. Numbering Python
 B. Number In Python
 C. Numerical Python
 D. None Of the above

Answer: C

Question 7:

 NumPy is often used along with packages like?

 A. Node.js
 B. Matplotlib
 C. SciPy
 D. Both B and C

Answer: D

Question 8:

What will be output for the following code?

 import numpy as np 
 dt = dt = np.dtype('i4') 
 print dt

 A. int32
 B. int64
 C. int128
 D. int16

Answer: A

Question 9:

The most important object defined in NumPy is an 
N-dimensional array type called?

 A. ndarray
 B. narray
 C. nd_array
 D. darray

Answer: A

Question 10:

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)

Answer: C

Question 11:

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

Answer: C

Question 12:

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

Answer: A

Question 13:

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

Answer: B

Question 14:

reshape() function in numpy array using python is:

 A. reshape(shape)
 B. array.reshape(shape)
 C. reshape(array, shape)
 D. numpy.reshape(array)

Answer: C

Question 15:

How to convert numpy array to list?

 A. array.list()
 B. array.list
 C. list.array()
 D. list(array)

Answer: D

Question 16:

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

Answer: B

Question 17:

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

Answer: B

Question 18:

full() function requires 2 arguments minimum to pass in it.

 A. true
 B. false
 C. none of above
 D. full() doesn't belong to numpy

Answer: A

Question 19:

Choose one of the unique property of numpy.

 A. array
 B. reshape
 C. shape
 D. Unicode

Answer: A

Question 20:

What does size attribute in numpy use to find?

 A. shape
 B. date & time
 C. objects
 D. number of items

Answer: D

Question 21

What is the use of shape() in numpy?

 A. change in shape of array
 B. reshaping of array
 C. shape of the array
 D. all of above

Answer: C

Question 22

import numpy as np
x = np.array(list)
what is the output of x here?

 A. conversion of list to array
 B. conversion of array to list
 C. conversion of list to list
 D. All of above

Answer: A

Question 23:

What does size() do in numpy?

 A. counts the number of elements
 B. estimates the array of maximum numbers
 C. finds shape of array
 D. code is wrong

Answer: A

Question 24:

fetch numpy as np
np.array(list)
Is it true to import numpy module like this?

 A. Yes, true
 B. Not, true

Answer: B

Question 25:

import numpy as np
np.array(list)
Is it true to import numpy module like this?

 A. Yes, true
 B. Not, true
 C. Error, this question makes no sense

Answer: A

Question 26:

Choose the correct option to pass arguments to full() function in numpy.

 A. only value
 B. only shape
 C. shape and value
 D. none of the above

Answer: C

Question 27:

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

Answer: E

Question 28:

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

Answer: B

Question 29:

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

Answer: B

Question 30:

Is the following statement true?
numpy array can be converted to the list in python3?

 A. Not at all
 B. Yes, true
 C. Yes, most of the time but not every time
 D. Not true because numpy has nothing to do with lists

Answer: B

Question 31:

How to find the type of numpy array?

 A. type(array)
 B. dtype
 C. objects.type(array)
 D. numpy(type)

Answer: B

Question 32:

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. options A & B

Answer: D

Question 33:

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

Answer: E

Question 34

What are the attributes of numpy array?

 A. shape, dtype, ndim
 B. objects, type, list
 C. objects, non vectorization
 D. Unicode and shape

Answer: A

Question 35:

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

Answer: D

Question 36:

Choose the correct statement to load numpy file in python.

 A. np.load(filename.npy)
 B. np.load()
 C. np.save(filename.npy, array)
 D. all of the above

Answer: A

Question 37:

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

Answer: B

Leave a Reply