top of page

Python NUMPY MCQ Questions

  • Writer: Rajesh Singh
    Rajesh Singh
  • Dec 1, 2024
  • 7 min read

Updated: Dec 6, 2025

Python NumPy Chapter MCQ:


1. What will be print?

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

Answer: D


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


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


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


5. import numpy as np

a = np.array([[1,2,3],[0,1,4]])

b = np.zeros((2,3), dtype = np.int 16)

c = np.ones ((2,3), dtype = np.int 16)

d = a+b+c

print(d[1,2])

A. 5

B. 7

C. 3

D. 4

Answer: A


6. Numpy stands for.

A. Numbering Python

B. Number in Python

C. Numerical Python

D. Number Python

Answer: C


7. numpy is used along with package like?

A. Node Js

B. Matplotlib

C. Scipy

D. Both(B)and(C)

Answer: D


8. import numpy as np

dt=dt= np.dtype(‘i,4’)

print(dt)

A. int 32

B. int 64

C. int 128

D. int 16

Answer: A


9. n- dimensional array type called?

A. ndarray

B. narray

C. nd_array

D. none

Answer:A


10. the sets the size of the buffer used in ufuncs?

A. bufsize(size)

B.setsize(size)

C. set bufsize(size)

D. Size(size)

Answer: C



11. if a dimension is given as _ in a reshaping operation, the other dimensions are

Automate cally calculated.

A. Zero

B. One

C. Negative one

D. Infinite

Answer: C


12. which of the following statement is false?

A. ndarray is also known as u axis array.

B. ndarray dataitem size is the buffer containing the actual elements of the array.

C. Numpy main object is the homogenous multidimensional array.

D. In numpy dimensions are called axes

Answer: A


13. Each builtin data type has a character code that uniquely identifie it. What is meaning of code “M”

A. timedata

B. Datatime

C. Object

D. Unicode

Answer: B


14. reshape() function is numpy array using python is ?

A. reshape (shape)

B. array. reshape (shape)

C. numpy. reshape (array)

D. reshape (array,shape)

Answer: D


15. How to convert numpy array to list?

A. array.list()

B. array. List

C. list. array

D. list (array)

Answer: D


16. The correct code to install numpy in the linux system containing python3?

A. pip numpy install python 3

B. pip3 install numpy

C. pip install numpy

D. python3 pip3 numpy install

Answer: C


17. The correct code to install numpy in the windows system containing python3?

A. pip3 install numpy

B. pip installnumpy

C. python3 install numpy

D. All of above

Answer: B


18. Fill () function requeres 2 arguments minimum to pas in it.

A. True

B. False

C. Fill () doesn’t belong to numpy

D. All of above

Answer: A


19. The unique property of Numpy.

A. array

B. reshape

C. shape

D. None

Answer: A


20. What does size attribute in numpy use to find?

A. shape

B. data & time

C. objects

D. numpy of items

Answer: D


21. Input numpy as np.

x = np. array(lis)

A. Conversion of list to array

B. Conversion of array to list

C. Conversion of list to list

D. All of the above

Answer: A


22. What is the use of shape () in numpy?

A. change in shape of array

B. reshapeing of array

C. shape of the array

D. All of the above

Answer: C


23. What does size () do in numpy?

A. Counts the numbers of elements

B. estimates the array of maximum numbers

C. finds shape of array

D. code in wrong

Answer: A


24. feteh numpy as np

np. array(list)

Is it true to import numpy module like this a

A. Yes, true

B. Not, true

Answer: B



25. Import numpy as np

np. array (list)

Is it true to import numpy module like this a

A. Yes, true

B. Not, true

C. Error, this question makes no sense

Answer: A


26. Creating ndarray, which is the built in functions in numpy.

A. np. array()

B. np.zero ()

C. np. empty ()

D. All of the above

Answer: D


27. The attribute of numpy array.

A. Shape, dtype,ndim

B. Objects,type,list

C. Object, non veclorization

D. Unicode and shape

Answer: A


28. The type of numpy array is.

A. type(array)

B. dtype

C. object, type,(array)

D. numpy(type)

Answer: B 

Q29. NumPy library has contained?

A.   N-Dimensional Array Object

B.   Tools For Integrating C/C++ And Fortran Code

C.   Fourier Transform

D.   All Of The Mentioned

 

Ans: D

 

Q30. Which is true method to access element from 2D array?

A.   print(A[0][2])

B.   print(A[1,2,3])

C.   print(A(0,1))

D.   None of Above

Ans: A

Q31. The shape of array is a-----of integers

A.   list

B.   set

C.   tuple

D.   Dictnary

Ans: C

 

Q32. Which function stacks 1 dimensional array as columns into 2dimentional array?

A.   row_stack

B.   column_stack

C.   Both A & B

D.   None of Above

Ans: B

 

Q33. Which sets the size of the buffer used in ufuncs?

A.   setbufsize(size)

B.   bufsetsize(size)

C.   setsize(size)

D.   bufsize(size)

Ans: A

 

Q34. Which is known as the set floating-point error callback function?

A.   settercall

B.   setterbuz

C.   setterstack

D.   None of Above

Ans:A

Q35. What is NumPy?

A.   It is a framework

B.   It is a web development framework

C.   Python library

D.   None of Above

Ans: C

 

Q36. How to represent multiplication of two NumPy arrays a and b?

A.      np.multiply(a,b)

B.      a.b

C.      a*b

D.     np.mult(a,b)

Ans: A

Q37. How to access the element at second row and third column of a two dimensional numpy?

A.      arr[1,2]

B.      arr[2,3]

C.      arr[0,1]

D.     arr[0,2]

Ans: A

Q38. What is the output of np.zeros(3,4) in Numpy?

A.      An array with zeros

B.      An array with ones

C.      An array with diagonal zeros

D.     None of Above

Ans: A

Q39. What is the function for calculate the mean of a NumPy array career?

A.      career.mean()

B.      np.mean(career)

C.      mean(career)

D.     None of Above

Ans: B

Q40. What is the function for calculate the maximum value in a Numpy array career?

A.      max_index=np.argmax(career)

B.      max_index=argmax(career)

C.      max_index=max(career)

D.     max_index=np.max(career)

Ans: A

Q41. What is the output of the following code ?

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

 (B) 21

(C) 12

(D) 28

Ans: B

Q42. What is the output of following code ?

import numpy as np

a = np.array([[1,2,3],[4,5,6]])

print(a.shape)

(A) (2, 3)

 (B) (3, 2)

(C) (1, 1)

 (D) None of these

Ans: A

Q43. What is the output of the following code ?

import numpy as np

a = np.array([1,2,3])

print(a.ndim)

(A) 1

(B) 2

(C) 3

(D) 0

Ans: A

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

Ans: C

Q45. What is the datatype of x ?

import numpy as np

a=np.array([1,2,3,4])

x= a.tolist()

(A) int

(B) array

(C) tuple

(D) list

Ans: B

Q46.What is the output of below code?

import numpy as np

a = np.array([1,2,3,5,8])

print (a.ndim)

(A) 0

(B) 1

(C) 2

(D) 3

Ans: B

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

Ans: D

Q48. What will be output for the following code ?

import numpy as np

a = np.array( [2, 3, 4, 5] )

print(a.dtype)

(A) int 32

(B) int

(C) float

(D) None of these

Ans: A

Q49. Eye() method is in ------------------------------

A.      Flask

B.      Numpy

C.      Both A & B

D.      None

Ans: B

Q50. In which year Numpy Library was created -----------------

A.      1991

B.      2005

C.      2010

D.      1992

Ans: B

Q51. [ : : -1] reverses the array ?

A.      True

B.      False

C.      May be

D.      None

Ans: A

Q52. Which method changes the shape of Numpy array in Python?

A.      Reshape()

B.      Shape()

C.      Both A and B

D.      Change()

Ans: A

Q53.By which Install numpy in computer--------------

A.      Pip install numpy

B.      Pip install numpy python

C.      Install numpy

D.      All of Above

Ans: A

Q54. Which function is used to find the total number of elements in a numpy array?

A.      Size

B.      Ndims

C.      Shape

D.      Resize

Ans: A

Q55. Which function modifies the original array and which function creates a new instance of the array.

A.      Resize, reshape

B.      Reshape, resize

C.      Ndims, resize

D.      Reshape and size

Ans: A

Q56. Which function is used for create sequence of numbers in Numpy?

A.      Shape

B.      Size

C.      Arrange

D.      None

Ans: C

Q57. Numpy is developed by………………………….

A.      Travis Oliphant

B.      Guido Van Rosum

C.      Tim Berners lee

D.      Tomilson

Ans: A

Q58. Import Numpy modules

A.      Import numpy

B.      Import numpy as numpy

C.      Import numpy as np

D.      All of Above

Ans: D

 Q59. What is the following python code?

import numpy

x=numpy.array([1,3,4,6])

y=numpy.array([2,7,8,4])

print(numpy.dot(x,y))

A.      [2,21,32,24]

B.      79

C.      2.21.32.24

D.      None

Ans: B

Q60. What is the output of below python code?

import numpy

x=numpy.array([2,3,4], dtype=complex)

print(x)

 

A.      [2.+0.j 3.+0.j 4.+0.j]

B.      [2,3,4]

C.      [2.0,3.0,4.0]

D.      None

Ans: A

Q61. User defined data type of Python is---------------

A.      Class

B.      list

C.      Tuples

D.      All of Above

Ans: A

Q62. Which mode of python gives instant result of typed statement?

A.      Interactive mode

B.      Script Mode

C.      Active mode

D.      Inactive mode

Ans: A

Q63. Which attribute represent the data type of numpy array?

A.      Dtype

B.      Dtype(array)

C.      Array(type)

D.      None

Ans: A

Q64. What is the datatype of y

 Import numpy as np

A=np.array([2,3,4])

y=A.tolist()

A.      int

B.      float

C.      array

D.      list

Ans: D

Q65.What is the output of below code?

Import numpy as np

X=np.array([[2,3,4]])

Print(x.ndim)

A.      0

B.      1

C.      2

D.      None

Ans: C

Q66. What is the output of below code?

import numpy as np

a=np.array([2,3,4,5])

print(a.dtype)

A.      int64

B.      int32

C.      int8

D.      float64

Ans: A

 


Numpy Video:






 

Recent Posts

See All
For Loop MCQ in Python

Q1. What is the output of the following Python code? x={1:"X",2:"Y",3:"Z"} for i,j in x.items():     print(i,j,end=" ") A.    1 X 2 Y 3 Z B.    1 2 3 C.    X Y Z D.   1:”X” 2:”Y” 3:”Z” Ans: A Q2.  Wha

 
 
 

Comments


bottom of page