Python MCQ - M3R5 Multiple Choice Questions and Answers PDF
Python MCQ - M3R5 Multiple Choice Questions and Answers PDF
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
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
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
print(len(list(map(list, x)))))
A. 1
B. 2
C. Error
D. Not specified
Answer: C
random.randrange(0,50)
A. 0
B. 1
C. 49
D. 50
Answer: 50
A. True
B. False
C. Sometimes
D. Never
Answer: B
A. Unlimited length
B. Limited length
Answer: A
A. True
B. Flase
C. Can’t s say
D. May be
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
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
Answer: D
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
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
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
A. Numbering Python
B. Number in Python
C. Numerical Python
D. None of these
Answer: C
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
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
D. All of mentions
Answer: A
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
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
A. Circles
B. Boxes
C. Arrows
D. Line
Answer: B
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
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
A. Denoted by triple quotes for providing the specification of certain program elements
Answer: D
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
B. Continue
C. Pass
D. None of these
Answer: A
A. def fun(a=2,b=3,c)
B. def fun(a=2,b,c=3)
D. def fun(a,b,c=3,d)
Answer: C
A. C
B. C++
C. Java
D. None of these
Answer: A
def func(a,b=5,c=10):
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
B. a is 3 and b is 7 and c is 10
a is 5 and b is 25 and c is 24
C. a is 7 and b is 3 and c is 10
a is 25 and b is 5 and c is 24
D. None of these
Answer: A
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 4:
if a>b
if a>c
Display a is the largest number.
Else
Else:
If b>c
Else
Step 5: stop
D. Stop
Answer: A
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
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
A. Input()
B. Tuple()
C. Print()
D. Dictionary()
Answer: D
Import math
abs(math.sqrt(36))
A. Error
B. 6
C. -6
D. 6.0
Answer: D
Answer: C
import numpy as np
a=np.array([11,2,3])
print(a.min())
A. 2
B. 1
C. 11
D. 3
Answer: A
A. Class Diagram
B. Code Comment
C. Use Case
D. Installation Guide
Answer: D
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)
Set 1:
set1.pdf
Download PDF • 7.41MB
Set 2:
set2.pdf
Download PDF • 7.51MB
Set 3:
set3.pdf
Download PDF • 6.94MB
Set 4:
set4.pdf
Download PDF • 6.26MB
Set 5:
set5.pdf
Download PDF • 5.59MB