top of page
Writer's pictureRajesh Singh

Python NUMPY MCQ Questions

Updated: Dec 11

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

Numpy Video:






 

50 views0 comments

Recent Posts

See All

For Loop MCQs 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...

Comments


bottom of page