top of page
Writer's pictureRajesh Singh

Python MCQ Questions with Answers

Updated: 3 days ago



1. What is the output of the below program in python:

print(0.2+0.4==0.6)

A. True

B. False

C. Error

D. Depends on machine

Answer: B: False due to not compare floating point value

2. Which is not a feature of Python language?

A. Interpreted language

B. Portable

C. High level language

D. Case Insensitive

Answer: D: Case Insensitive

3. Python is a ………….object-oriented programming language.

A. Special purpose

B. General purpose

C. Medium level programming language

D. All of the mentioned above

Answer: B: General purpose

4. Developer of Python programming?

A. Denis Ritchie

B. Y.C. Khenderakar

C. Tim Berner Lee

D. Guido van Rossum

Answer: D: Guido van Rossum

5. What is the output in python language?

Round (.4)-Round (-.5)

A. 0

B. 1

C. 2

D. .9

Answer: B: 1

6. Which are the application areas of Python programming?

A. Web Development

B. Game Development

C. Artificial Intelligence and Machine Learning

D. All of the above

Answer: D: All of the above

7. What is Numeric Types of Data Types?

A. int

B. float

C. complex

D. All of the above

Answer: D: All of the above

8. What is output in python?

A. print(r"\nhi")

B. hi

C. new line and hi

D. error

E. \nhi

Answer: D: \nhi

9. What is output for below code?

a=2

b=3

print(a,b)

a,b=b,a

print(a,b)


A. 23 23

B. 23 32

C. 32 32

D. None of Above

Answer: B

10. list, tuple dictionary are which types of Data Types.

A. Binary Types

B. Boolean Types

C. Sequence Types

D. None of the above

Answer: C: Sequence Types

11. Which types of logical operators in Python?

A. AND

B. OR

C. NOT

D. All of the above

Answer: D: All of the above

12. What is the name of the operator ** in Python?

A. Exponentiation

B. Modulus

C. Floor division

D. None of the these

Answer: A: Exponentiation

13. What is the output of following code?

x="Ram, Shya"

print(x[::5]

A. RS

B. RAMSH

C. RAM

D. SHYAM

Answer: A: RS



14. What is the extension of Python Program?

A. .execute python

B. .python

C. .py

D. .run python

Answer: C: .py

15. Which keyword used in python language?

A. finally

B. lambda

C. while

D. All of Above

Answer: D: All of Above

16. Which return the % operator?

A. Quotient

B. Divisor

C. Remainder

D. Multiplication

Answer: C: Remainder

17. What is the maximum possible length of an identifier?

A. 31 characters

B. 63 characters

C. 79 characters

D. 69 characters

Answer: C: 79 characters

18. Which are methods of list?

A. append()

B. extend()

C. insert()

D. All of the above

Answer: D: All of the above

19. The list.pop ([i]) is used for removing the item at the given position in the list?


A. Yes

B. No

Answer: A: Yes

20. What is the output of following program?

r = lambda q: q * 2

s = lambda q: q * 3

x = 2

x = r(x)

x = s(x)

x = r(x)

print (x)

A. 4

B. 12

C. 24

D. None of Above

Answer: C: 24

21. What is the output of following program?

a = 4.5

b = 3

print (a//b)

A. 1.0

B. 2.0

C. 0

D. None of Above

Answer: A: 1.0

22. What is the output of following program?

a = True

b = False

c = False

if a or b and c:

print ("CAREERBODHSANSTHAN")

else:

print ("careerbodh")

A. CAREERBODHSANSTHAN

B. Careerbodh

C. CAREERBODHSANSTHAN Careerbodh

D. None of Above

Answer: A

23. Python is.........

A. Programming Language

B. Web browser

C. Malware

D. Operating System

Answer: A

24. Python Dictionary is used to store the data in

A. Key value pair

B. set value pair

C. tuple value pair

D. None of the above

Answer: A:

25. Which is invalid variable?

A. my_string_1

B. _

C. Foo

D. 1st_string

Answer: D

26. What is the output of given code?

4+2**5//10

A. 77

B. 7

C. 3

D. 0


Answer: B



27. The Python language developed in which?

A. 1995

B. 1989

C. 1972

D. 1981

Answer: B

28. What do we use to define a block of code in Python language?

A. Key

B. Indentation

C. Brackets

D. All of above

Answer: B

29. Single line comment in python?

A. /

B. //

C. #

D. !

Answer: C

30. What is the output of below program?

count = 1

def careerbodh():

global count

for i in (1, 2, 3):

count += 1

careerbodh()

print (count)

A. 1

B. 2

C. 3

D. 4

Answer: D

31. Conditional statements are also known as

A. Decision-making

B. Array

C. List

D. Looping

Answer: A:

32. What is output of below code?

for i in range(2):

print (i)

for i in range(4,5):

print (i)

Answer:

0

1

4

33. Which is not used as conditional statement in Python?

A. switch

B. if...else

C. elif

D. for

Answer: A

34. The return value for trunc() is:


A. bool

B. float

C. int

D. string

Answer: C

35. What is the output of below code?

print(2**3 + (2+ 6)**(1 + 1))

A. 72

B. 18

C. 22

D. None of Above

Answer: 72


36. What is the output of below program?

var = 10

print(type(var))

var = "Ram"

print(type(var))

A. str and int

B. int and str

C. int and int

D. str and str

Answer: B

37. Is Python programming compiled or interpreted?

A. Python program is both compiled and interpreted

B. Python program is neither compiled nor interpreted

C. Python program is only compiled

D. Python program is only interpreted

Answer: B

38. What is the output of below code?

a = "Careerbodh"

b = 13

print (a + b)

A. Careerbodh

B. 13

C. Careerbodh13

D. Error

Answer: D

39. Nested if Statements represents?

A. if statement inside another if statement

B. if statement outside the another if statement

C. Both A and B

D. None of the above

Answer: A

40. Which statements is correct about the object-oriented programming concept in Python?


A. Classes are real-world entities while objects are not real

B. Objects are real-world entities while classes are not real

C. Both A and B

D. None of them

Answer: B

41. The output of below Python code is:

a = [‘cr’, ‘bd’]

for i in a:

i.upper()

print(a)

A. [None, None]

B. [‘CR’, ‘BD’]

C. [‘cr’, ‘bd’]

D. None of the above

Answer: C



42. The output of below Python code is:

print(“cro. BOD”.capitalize())

A. Cro. Pqr

B. Cro. bod

C. CRO. BOD

D. cro. bod

Answer: B

43. Which arithmetic operators can not use with strings?

A. –

B. +

C. *

D. None of them

Answer: A

44. What is output of below python code?

dict= {1:'1', 2:'2', 3:'3'}

del dict[1]

dict[1] = '10'

del dict[2]

print (len(dict))

A. 1

B. 2

C. 3

D. 0

Answer: B

45. Which method inside the class in python programing language?

A. Object

B. Function

C. Attribute

D. Argument

Answer: B

46. Which () removes a set’s first and the last element from a given list?


A. pop

B. remove

C. dispose

D. discard

Answer: A

47. In Python, the break and continue statements, together which are called….

A. Jump

B. goto

C. compound

D. break

Answer: B

48. The output of below Python code -

x={1:”X”,2:”Y”,3:”Z”}

del x

A. the del method does not exist for dictionary

B. the del would delete the values present in dictionary

C. the del would delete all the keys in dictionary

D. the del would delete the entire dictionary

Answer: C

49. Which declarations is incorrect?

A. _x = 1

B. __b = 9

C. __xy__ = 7

D. None of Above

Answer: D

50. Which not a keyword in Python language?

A. val

B. raise

C. try

D. with

Answer: A


51. The output of below Python program is

sum(1,3,3)

sum([2,5,6])

A. 7, 13

B. Error, Error

C. Error, 13

D. 7, Error

Answer: C

52. The output of below Python program:

def find(a, **b):

print(type(b))

find(‘letters’,a=’1′,b=’2′)

A. An exception is thrown

B. String

C. Dictionary

D. Tuple

Answer: C


53. Which is NOT true about recursion?

A. We can replace a recursive function by a non-recursive function

B. The memory space taken by the recursive functions is more than that of non-recursive function

C. The process of recursion makes it easier for users to understand a program

D. Running a recursive function is more rapidly as compared to a non-recursive function

Answer: D


54. The output of below Python program is

x = [‘ab’, ‘cd’]


print(len(list(map(list, x)))))


A. 1

B. 2

C. Error

D. Not specified

Answer: C


55. In Python, the primary use of the tell() method is that:

A. within the file, it tells the current position

B. within the file, it tells the end position

C. it tells us if the file is opened

D. none of the above

Answer: A

56 - What is output of below python code:

str = ['career', 'bodh', 'snasthan']

' '.join(str)

A. ['careerbodhsansthan']

B. ' careerbodhsansthan '

C. [' career bodh sansthan ']

D. ' career bodh sansthan '

Answer: B

57. False statement in python

A. int(256)== 256

B. int('256')== 256

C. int(256.0)== 256

D. None of the these

Answer: D


58. What is output of python code:

print('car'.partition('xy'))

A. ('car', 'wz', ' ')

B. ('car')

C. Name error

D. ('car', ' ', ' ')


Answer: D

59. Let two sets X & Y, then X<Y is:

A. True if len(X) is less than len(Y).

B. True if the elements in X when compared are less than the elements in Y.

C. True if X is a proper subset of Y.

D. True if X is a proper superset of Y.

Answer: C

60. What is the output of the following code?


def f(x = 400, y = 500):

return(x+y, x-y)

x, y = f(y = 600, x = 200)

print(x, y)

A. 900 -100

B. 800 -400

C. 400 500

D. None of Above

Answer: B

61 Which is Identifier in Python?

A. 3yz

B. $1xy

C. @pyth

D. _ab4

Answer: D



July 2022 Exam Paper Set 1:

Q1. Which is the following number can never be generated by the following code:


random.randrange(0,50)


A. 0


B. 1


C. 49


D. 50


Answer: 50


Q2. Python is a case sensitive language when dealing with identifiers.


A. True


B. False


C. Sometimes


D. Never


Answer: B


Q3.Which of the following is true for variable names?


A. Unlimited length


B. Limited length


C. Ampersand can be used in its name


D. None of the Above


Answer: A


Q4. The examination of changing values of variables is called stepping.


A. True


B. Flase


C. Can’t s say


D. May be


Answer: B (called Tracing)


Q5. What will be the output of the following?


Import numpy as np


Print(np.minimum([2,3,4],[1,5,2]))


A. [1 2 5]


B. [1 5 2]


C. [2 3 4]


D. [1 3 2]


Answer: D


Q6.What is the data type of following object?


A=[5,’abc’,3,2,6]


A. Tuple


B. Array


C. List


D. Dictionary


Answer: C



Q7. Flowcharts and algorithms are used for


A. Better programming


B. Efficient coding


C. Easy testing and debugging


D. All of the Above


Answer: D


Q8. Determine the output:


for i in range(20,30,10):


j=i/2


print(j)


A. 10 15


B. 10.0 15.0


C. 10.0


D. None of these


Answer: C


Q9. Method which uses a list of well defined instructions to complete a task starting from a given initial state to end state is called as----------


A. Program


B. Algorithm


C. Flowchart


D. Both A and C


Answer: B


Q10. -------- is a connector showing the relationship between the representative shapes.


A. Line


B. Arrow


C. Process


D. Box


Answer: B


Q11. ---------------------- scans the entire program and translates it as a whole into machine code.


A. Compiler


B. Interpreter


C. Debugger


D. None of Above


Answer: A


Q12.What is the output of below python code?


def say(message, times=1):


print(message*times)


say('Hello')


say('World',5)


A. Hello


WorldWorldWorldWorldWorld


B. Hello


World5


C. Hello


World,World,World,World,World


D. Hello


HelloHelloHelloHelloHello


Answer: A



Q13. The action performed by a -------structure must eventually cause the loop to terminate.


A. Sequence


B. Process


C. Repetition


D. Case


Answer: C


Q14. The output of following python code ---


a=true


b=false


c=false


if a or b and c:


print("HELLO")


else:


print ("hello")


A. HELLO


B. Hello


C. HellO


D. None of these


Answer: A


Q15. NumPy stands for


A. Numbering Python


B. Number in Python


C. Numerical Python


D. None of these


Answer: C


Q16. A flowchart that outlines the main segment of a program.


A. Queue


B. Macro


C. Micro


D. Union


Answer: B


Q17. Which statement will move file pointer 10 bytes backward from current position?


A. f.seek(-10,0)


B. f.seek(-10,1)


C. f.seek(10,0)


D. None of above


Answer: A




Q18. Choose the answer for statement 1


Import-----------------------# statement 1


Rect=[]


While True:


m=int(input(“Enter”))


nm=input(“Enter”)


Temp=[m,nm]


Rect.append(temp)


Ch=input(“Enter choice(Y?N”)


If ch.upper==”N”:


Break


F=open(stud.dat”,”--------------------------“) #statement 2


------------------------------.dump(rec,f) #statement 3


-----------------.close() #statement 4


A. csv


B. load


C. pickle


D. unpickle


Answer: C


Q19. Which of the following is the use of function in python?


A. Functions are reusable pieces of programs


B. Functions do not provide better modularity for your application


C. You cannot also create your own functions


D. All of mentions


Answer: A


Q20. What is the output of following code?


A=[[1,2,3],


[4,5,6],


[7,8,9]]


print(A[1][:])




A. [1,2,3]


B. [4,5,6]


C. [2,5,8]


D. None of these


Answer: B


Q21. What will be output for the following code?


import numpy as np


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


b=np.array([0,1,5,4,2])


c=a+b


c=c*a


print(c[2])


A. 6


B. 10


C. 0


D. None of these


Answer: A


Q22. Actual instructions in flowcharts are represented in -----


A. Circles


B. Boxes


C. Arrows


D. Line


Answer: B





Q23.In Python, which of the following functions is a built-in function?


A. val()


B. print()


C. func_k()


D. None of these


Answer: B


Q24. Which mode creates a new line file if the file does not exist?


A. Write mode


B. Append mode


C. Both A & B


D. None of the these


Answer: C



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


Answer:B


Q26. Which of these definitions correctly describes a module?


A. Denoted by triple quotes for providing the specification of certain program elements


B. Design and implement of specific functionality to be incorporated into a program


C. Defines the specifications of how it is to be used


D. Any program that reuses code


Answer: D


Q27. What is the output of the following code?


a=15


b=6


print(a and b)


print(a or b)


A. True True


B. False False


C. 6 15


D. 15 6


Answer: C


Q28. ------------------------------ immediately terminates a loop entirely.


A. Break


B. Continue


C. Pass


D. None of these


Answer: A




Q29. Identity the correct function header.


A. def fun(a=2,b=3,c)


B. def fun(a=2,b,c=3)


C. def fun (a,b=2,c=3)


D. def fun(a,b,c=3,d)


Answer: C


Q30. In which language is Python written?


A. C


B. C++


C. Java


D. None of these


Answer: A


Q31. What is the output of the below program?


def func(a,b=5,c=10):


print('a is',a,'and b is',b,'and c is',c)


func(3,7)


func(25,c=24)


func(c=50,a=100)


A. a is 3 and b is 7 and c is 10


a is 25 and b is 5 and c is 24


a is 100 and b is 5 and c is 50


B. a is 3 and b is 7 and c is 10


a is 5 and b is 25 and c is 24


a is 50 and b is 100 and c is 5


C. a is 7 and b is 3 and c is 10


a is 25 and b is 5 and c is 24


a is 5 and b is 100 and c is 50


D. None of these


Answer: A


Q32. In computer science, algorithm refers to a pictorial representation of a flowchart.


A. True


B. False


C. Can’t say


D. May be


Answer: B




Q33.What will be the output of the following algorithm for a=5, b=8, c=6?


Step 1: Start


Step 2: Declare variable a, b and c.


Step 3: Read variable a, b and c.


Step 4:


if a>b


if a>c


Display a is the largest number.


Else


Display c is the largest number.


Else:


If b>c


Display b is the largest number.


Else


Display c is the greatest number.


Step 5: stop


A. B is the largest number


B. A is the largest number


C. C is the largest number


D. Stop


Answer: A


Q34. What is the output of the following code?


import numpy as np


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


print(a.dtype)


A. int32


B. float64


C. float


D. None of these


Answer: B


Q35.Choose the answer for statement 4


Import-----------------------# statement 1


Rect=[]


While True:


m=int(input(“Enter”))


nm=input(“Enter”)


Temp=[m,nm]


Rect.append(temp)


Ch=input(“Enter choice(Y?N”)


If ch.upper==”N”:


Break


F=open(stud.dat”,”--------------------------“) #statement 2


------------------------------.dump(rec,f) #statement 3


-----------------.close() #statement 4





A. F


B. Rec


C. File


D. Stud


Answer: A



Q36. Which of the following is not the built in function?


A. Input()


B. Tuple()


C. Print()


D. Dictionary()


Answer: D


Q37. What will be the output of following code?


Import math


abs(math.sqrt(36))


A. Error


B. 6


C. -6


D. 6.0


Answer: D


Q38.What is the full form of CSV?


A. Comma Separation Value


B. Comma Separated Variable


C. Comma Separated Values


D. Common Syntax Value


Answer: C


Q39. What will be output for the following code?


import numpy as np


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


print(a.min())


A. 2


B. 1


C. 11


D. 3


Answer: A


Q40. ----------------------- is part of user documentation.


A. Class Diagram


B. Code Comment


C. Use Case


D. Installation Guide


Answer: D





For more questions click here


Function chapter MCQ

1). Function keyword use

(a). define

(b). fun

(c). def

(d). function

Answer-(c)

2). Function header items present

(a). function name

(b). parameter list

(c). return value

(d). Both(a)and(b)

Answer-(d)

3). Function class defind

(a). class

(b). function

(c). method

(d). module

Answer-(c)

4). Function return statement function return

(a). none

(b). 0

(c). null

(d). Arbitary value

Answer-(a)


5). Recursive function

(a). funtion other function call

(b). A function which calls itself

(c). Both (a)and(b)

(d). None of these

Answer-(b)

6). Python id() use

(a). Id() returns the size of object

(b). Id() returns the idenity of the object

(c). Both(a)and(b)

(d). None of above

Answer-(b)

7). Function header correct

(a). def fun (a=2,b=3,c)

(b). def fun (a=2,b,c=3)

(c). def fun (a,b=2,c=3)

(d). def fun (a,b,c=3,d)

Answer-(c)

8). In which part of memory does the system stores the parameter and local variable of function call ?

(a). heap

(b). stack

(c). Uninitialized data segment

(d). None of above

Answer-(b)



9). Which of the following will print the pi value defined in math module?

(a). print(pi)

(b). print(math.pi)

(c). from math import pi print(pi)

(d). from math import pi print(math.pi)

Answer-(c)

10). Packages modules import operator python used

(a). * (b). .

(c). -> (d). &

Answer-(b)

11). Function define

(a). module

(b). class

(c). Another function

(d). All of the above

Answer-(d)

12). Python lambda function

(a). true

(b). false

(c). Lambda is a function in python but user can is it.

(d). None of the above

Answer-(a)

13). What is a variable defind outside a function referred to as?

(a). local variable

(b). global variable

(c). static variable

(d). None of above

Answer-(b)

14). What is the output of following program

Z=lambda x:x*x

Print(z(6))

(a). 6 (b). 36 (c). 0 (d). error

Answer-(b)

15). What is the output of below python program.

(a). a

(b). A

(c). 97

(d). error

Answer-(a)

16). How is a function declared in python?

(a). def function function_name():

(b). declared function function_name()

(c). def function_name()

(d). declare function_name()

Answer-(c)



17). Which is the correct way of calling function?

(a). function_name()

(b). call function_name()

(c). both(a)and(b)

(d). None of above

Answer-(a)

18). Choose the correct option with reference to below python code?

def fn(a):

print(a)

x=90

fn(x)

(a). x is the format argument

(b). a is the actuial argument

(c). fn(x) is the function signature

(d). x is the actual argument

Answer-(d)

19). You can also create your owen function,these function are called.

(a). built in function

(b). user defined function

(c). py function

(d). None of above

Answer-(b)



20). The code block within arry fuction status with a?

(a). ; (b). : :

(c). : (d). %

Answer-(c)

21). A return statement with_____agruments.

(a). No

(b). 1

(c). 2

(d). Any

Answer-(a)

22). ____ are tge argument passed to a function is correct positional order.

(a). Required argument

(b). keyword argument

(c). Default argument

(d). variable lenth argument

Answer-(c)

23). Output of following python code.

Def say Hello():

print(‘Hello world!’)

say Hello()

say Hello()

(a). Hello world!

Hello word!

(b). Hello

Hello

(c). world!

(d). world!

Hello

Answer-(a)

24). What is output:-

Def print Max(a,b):

if a>b:

elif a==b:

print(a, ’is equal to’,b)

else:

print(b, ‘is maximum’)

print Max(3,4)

(a). 3

(b). 4

(c). 4 is maximum

(d). None

Answer-(c)

25). What is output:-

x=50

def func(x):

print(‘x is’,x)

x=2

print(‘changed local x to’ ,x)

fun(x)

print(‘x is now’ ,x)

(a). x is 50 changed local x to 2 x is now 50

(b). x is 50 changed local x to 2 x is now 2

(c). x is 50 changed local x to 2 x is now 100

(d). None of above

Answer-(a)



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 C. nd_array

B. narray D. none

Answer:

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



Set 1:


Set 2:


Set 3:




Set 4:


Set 5:




18,797 views0 comments

Recent Posts

See All

Files MCQ in Python

File Processing MCQ Q1. Which function writes a list of lines in File? A.      Writelines() B.      Write() C.      Tell() D.      All of...

Python List MCQ Questions

Q1. What is output of below python code? dict= {1:'1', 2:'2', 3:'3'} del dict[1] dict[1] = '10' del dict[2] print (len(dict)) A. 1 B. 2...

Comments


bottom of page