
Python MCQ with Answers
Updated: Nov 15, 2022
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