Python NumPy MCQ Questions And Answers
This section focuses on "Python NumPy" for Data Science. These Python NumPy Multiple Choice Questions (MCQ) should be practiced to improve the Data Science skills required for various interviews (campus interview, walk-in interview, company interview), placements, entrance exams and other competitive examinations.
1. NumPY stands for?
A. Numbering Python
B. Number In Python
C. Numerical Python
D. None Of the above
View Answer
Ans : C
Explanation: NumPy, which stands for Numerical Python, is a library consisting of multidimensional array objects
2. NumPy is often used along with packages like?
A. Node.js
B. Matplotlib
C. SciPy
D. Both B and C
View Answer
Ans : D
Explanation: NumPy is often used along with packages like SciPy (Scientific Python) and Matplotlib (plotting library)
3. The most important object defined in NumPy is an N-dimensional array type called?
A. ndarray
B. narray
C. nd_array
D. darray
View Answer
Ans : A
Explanation: The most important object defined in NumPy is an N-dimensional array type called ndarray.
4. What will be output for the following code?
import numpy as np
a = np.array([1,2,3])
print a
A. [[1, 2, 3]]
B. [1]
C. [1, 2, 3]
D. Error
View Answer
Ans : C
Explanation: The output is as follows : [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
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]
View Answer
Ans : D
Explanation: The output is as follows : [ 1.+0.j, 2.+0.j, 3.+0.j]
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
View Answer
Ans : A
Explanation: ndarray is also known as the "alias array".
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
View Answer
Ans : C
Explanation: If a dimension is given as -1 in a reshaping operation, the other dimensions are automatically calculated.
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)
View Answer
Ans : C
Explanation: Adjusting the size of the buffer may therefore alter the speed at which ufunc calculations of various sorts are completed.
9. 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
View Answer
Ans : A
Explanation: The output is as follows : int32
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
View Answer
Ans : B
Explanation: "M" : datetime
Discussion