Google News
logo
NumPy - Quiz(MCQ)
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)

5 .
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]

6 .
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

7 .
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) :  

8 .
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.