Google News
logo
NumPy - Quiz(MCQ)
A)
Numerical Python
B)
Number In Python
C)
Numbering Python
D)
None Of the above

Correct Answer : Option (A) :   Numerical Python


Explanation : NumPy, which stands for Numerical Python, is a library consisting of multidimensional array objects

A)
Jim Hugunin
B)
Wes McKinney
C)
Travis Oliphant
D)
Guido van Rossum

Correct Answer : Option (C) :   Travis Oliphant

A)
Operations related to linear algebra.
B)
Mathematical and logical operations on arrays.
C)
Fourier transforms and routines for shape manipulation.
D)
All of the above

Correct Answer : Option (D) :   All of the above

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

Correct Answer : Option (D) :   Both B and C


Explanation : NumPy is often used along with packages like SciPy (Scientific Python) and Matplotlib (plotting library)

A)
fourier transform
B)
n-dimensional array object
C)
tools for integrating C/C++ and Fortran code
D)
All of the mentioned

Correct Answer : Option (D) :   All of the mentioned


Explanation : NumPy is the fundamental package for scientific computing with Python.

A)
iid_
B)
ix_
C)
ixd_
D)
None of the above

Correct Answer : Option (B) :   ix_


Explanation : Length of the 1D boolean array must coincide with the length of the dimension (or axis) you want to slice.

A)
setsize(size)
B)
bufsize(size)
C)
setbufsize(size)
D)
All of the mentioned

Correct Answer : Option (C) :   setbufsize(size)


Explanation : Adjusting the size of the buffer may therefore alter the speed at which ufunc calculations of various sorts are completed.

A)
.types
B)
.class
C)
.type
D)
None of the above

Correct Answer : Option (A) :   .types


Explanation : Universal functions in NumPy are flexible enough to have mixed type signatures.

A)
column_stack
B)
com_stack
C)
row_stack
D)
All of the above

Correct Answer : Option (A) :   column_stack


Explanation : column_stack is equivalent to vstack only for 1D arrays.

A)
resize, reshape
B)
reshape, resize
C)
reshape2, resize
D)
None of the above

Correct Answer : Option (B) :   reshape, resize


Explanation : If a dimension is given as -1 in a reshaping operation, the other dimensions are automatically calculated.

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

Correct Answer : Option (D) :   ndarray


Explanation : The most important object defined in NumPy is an N-dimensional array type called ndarray.

A)
numpy.array(object, dtype = None, copy = True, order = None, ndmin = 0)
B)
numpy.array(object, dtype = None, copy = True, 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, subok = False, ndmin = 0)

Correct Answer : Option (C) :   numpy.array(object, dtype = None, copy = True, order = None, subok = False, ndmin = 0)


Explanation : It creates an ndarray from any object exposing array interface, or from any method that returns an array : numpy.array(object, dtype = None, copy = True, order = None, subok = False, ndmin = 0).

A)
objects
B)
Unicode
C)
datetime
D)
timedelta

Correct Answer : Option (C) :   datetime

A)
(0 to 4294967295)
B)
(0 to 65535)
C)
(-32768 to 32767)
D)
(-2147483648 to 2147483647)

Correct Answer : Option (A) :   (0 to 4294967295)


Explanation : uint32 : Unsigned integer (0 to 4294967295)

15 .
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]
B)
[10 20 30]
C)
[[10 20 30]]
D)
Error

Correct Answer : Option (B) :   [10 20 30]

16 .
What will be output for the following code?
import numpy as np 
dt = dt = np.dtype('i4') 
print dt

 

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

Correct Answer : Option (B) :   int32

17 .
What will be output for the following code?
 
import numpy as np 
a = np.array([1,2,3]) 
print a
A)
[1]
B)
[[1, 2, 3]]
C)
[1, 2, 3]
D)
Error

Correct Answer : Option (C) :  

18 .
What will be output for the following code?
 
import numpy as np 
a = np.array([1, 2, 3,4,5], ndmin = 2) 
print a
A)
[1, 2]
B)
[1, 5]
C)
[1, 2, 3, 4, 5]
D)
[[1, 2, 3, 4, 5]]

Correct Answer : Option (D) :   [[1, 2, 3, 4, 5]]

A)
arange
B)
aline
C)
aspace
D)
All of the Above

Correct Answer : Option (A) :   arange


Explanation :

When arange is used with floating point arguments, it is generally not possible to predict the number of elements obtained.

A)
matplotlib will enable you to plot graphics
B)
ipython is an enhanced interactive Python shell
C)
Both (a) and (b)
D)
rPy provides a lot of scientific routines that work on top of NumPy

Correct Answer : Option (D) :   rPy provides a lot of scientific routines that work on top of NumPy


Explanation : SciPy provides a lot of scientific routines that work on top of NumPy.

A)
one_alike
B)
ones_like
C)
all_like
D)
None of the above

Correct Answer : Option (B) :   ones_like


Explanation : The optional output arguments of the function can be used to help you save memory for large calculations.

A)
Numpy array class is called ndarray
B)
In Numpy, dimensions are called axes
C)
NumPy main object is the homogeneous multidimensional array
D)
All of the mentioned

Correct Answer : Option (D) :   All of the mentioned

A)
copy
B)
paste
C)
view
D)
All of the above

Correct Answer : Option (C) :   view

A)
fmin
B)
minimum
C)
iscomplex
D)
None of the above

Correct Answer : Option (C) :   iscomplex


Explanation : iscomplex function returns a bool array, where true if input element is complex.

A)
settercall
B)
setter
C)
setterstack
D)
All of the above

Correct Answer : Option (A) :   settercall

A)
fmod
B)
frexp
C)
trunc
D)
ldexp

Correct Answer : Option (B) :   frexp

27 .
What will be output for the following code?
 
import numpy as np 
a = np.array([1, 2, 3], dtype = complex) 
print a
A)
[ 1.+0.j]
B)
[[ 1.+0.j, 3.+0.j]]
C)
[[ 1.+0.j, 2.+0.j, 3.+0.j]]
D)
[ 1.+0.j, 2.+0.j, 3.+0.j]

Correct Answer : Option (D) :   [ 1.+0.j, 2.+0.j, 3.+0.j]

A)
One
B)
Zero
C)
Infinite
D)
Negative one

Correct Answer : Option (D) :   Negative one


Explanation : If a dimension is given as -1 in a reshaping operation, the other dimensions are automatically calculated.

A)
numpy_dtype(object, align, copy)
B)
numpy.dtype(object, align, copy, ndmin)
C)
numpy.dtype(object, align, copy)
D)
numpy.dtype(object, align, copy, subok)

Correct Answer : Option (C) :   numpy.dtype(object, align, copy)


Explanation : A dtype object is constructed using the following syntax : numpy.dtype(object, align, copy)

A)
The array object returned by __array_prepare__ is passed to the ufunc for computation.
B)
Many of the built-in functions are implemented in compiled C code
C)
Some ufuncs can take output arguments.
D)
Broadcasting is used throughout NumPy to decide how to handle disparately shaped arrays

Correct Answer : Option (A) :   The array object returned by __array_prepare__ is passed to the ufunc for computation.


Explanation : The array object returned by __array_prepare__ is passed to the ufunc for computation is true

31 .
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)
25
B)
21
C)
12
D)
9

Correct Answer : Option (B) :   21

32 .
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)
B)
1
C)
2
D)
3

Correct Answer : Option (D) :   3

A)
pip3 install numpy
B)
pip install numpy
C)
pip numpy install python3
D)
python3 pip3 numpy install

Correct Answer : Option (A) :   pip3 install numpy

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

Correct Answer : Option (A) :   true

A)
import numpy
B)
from numpy import *
C)
import numpy as np
D)
All of the above

Correct Answer : Option (D) :   All of the above

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

Correct Answer : Option (B) :   np.load(filename.npy)

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

Correct Answer : Option (C) :   counts the number of elements

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

Correct Answer : Option (C) :   reshape(array, shape)

39 .
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)
6
C)
7
D)
8

Correct Answer : Option (A) :   5

A)
finds the maximum number in numpy array
B)
makes operation of minus if x < 100
C)
Both (a) and (b)
D)
finds the minimum number in numpy array

Correct Answer : Option (D) :   finds the minimum number in numpy array