100% found this document useful (1 vote)
931 views

Numpy Multiple Choice Questions and Answers - NF AI

This document contains 23 multiple choice questions about the NumPy Python library. It tests knowledge of NumPy concepts like arrays, data types, installation, functions like reshape(), shape, and size.

Uploaded by

lxtmai281995
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
931 views

Numpy Multiple Choice Questions and Answers - NF AI

This document contains 23 multiple choice questions about the NumPy Python library. It tests knowledge of NumPy concepts like arrays, data types, installation, functions like reshape(), shape, and size.

Uploaded by

lxtmai281995
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

Numpy Multiple Choice Questions And -12%

Answers
 Bilal Muhammad (https://www.nfaicompany.com/author/mubquaidian/) -  August 21, 2021 -
 MCQs (https://www.nfaicompany.com/category/multiple-choice-questions/) -
 1 Comment (https://www.nfaicompany.com/numpy-mcqs/?noamp=mobile#comments)

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

MCQs Search

S E AR C H
Question 1:

What will be printed? Subscribe

Sign up for our newsletter and stay up to date


import numpy as np
a = np.array([1,2,3,5,8]) First name

b = np.array([0,3,4,2,1])
c = a + b Last name

c = c*a
print (c[2])
Email*

A. 7
Can we send you an email from time to
B. 12
time?
C. 10
S UBS C R I BE
D. 21
E. 28
-12%

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])
Recent Posts
A. 0
Tips and Tricks for Training a Pretrained
B. 1 Machine Learning Model for Prediction
C. 2 (https://www.nfaicompany.com/tips-and-tricks-

D. 3 for-training-a-pretrained-machine-learning-
model-for-prediction/)
Tips and Tricks for Working with Encoders and
Answer: D Autoencoders in Machine Learning
(https://www.nfaicompany.com/tips-and-tricks-
Question 3: for-working-with-encoders-and-autoencoders-
in-machine-learning/)
Tips and Tricks for Working with Transformers:
A Powerful Library for NLP

(https://www.nfaicompany.com/tips-and-tricks-
What will be output for the following code? for-working-with-transformers-a-powerful-
library-for-nlp/)
Tips and Tricks for Working with scikit-learn, a
import numpy as np
ML Library in Python
a = np.array([[1,2,3],[0,1,4]]) (https://www.nfaicompany.com/tips-and-tricks-
print (a.size) for-working-with-scikit-learn-a-ml-library-in-
python/)
Tips and Tricks for Building Image Classifiers
A. 1
using Python
B. 5 (https://www.nfaicompany.com/tips-and-tricks-
C. 6 for-building-image-classifiers-using-python/)
D. 4

Answer: C
Achives
Question 4:

Archives

Select Month 
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

Find more MCQs here… (https://www.nfaicompany.com/category/multiple-choice-questions/)

TAGS: IMPORT NUMPY (HTTPS://WWW.NFAICOMPANY.COM/TAG/IMPORT-NUMPY/), IMPORT NUMPY AS NP


(HTTPS://WWW.NFAICOMPANY.COM/TAG/IMPORT-NUMPY-AS-NP/), MUTIPLE CHOICE QUESTIONS AND ANSWERS
(HTTPS://WWW.NFAICOMPANY.COM/TAG/MUTIPLE-CHOICE-QUESTIONS-AND-ANSWERS/), NUMPY AND PANDAS
(HTTPS://WWW.NFAICOMPANY.COM/TAG/NUMPY-AND-PANDAS/), NUMPY MCQS (HTTPS://WWW.NFAICOMPANY.COM/TAG/NUMPY-MCQS/),
NUMPY PYTHON (HTTPS://WWW.NFAICOMPANY.COM/TAG/NUMPY-PYTHON/), NUMPY W3SCHOOLS
(HTTPS://WWW.NFAICOMPANY.COM/TAG/NUMPY-W3SCHOOLS/)

You might also like