Learn Python MCQs

Prepare Python MCQs (Multiple choice Questions) for exam and job interviews.

What is the output of print(1 + 2 * 3)?

1) 9

2) 7

3) 6

4) 5

Answer : 7

What is the purpose of the pass statement in Python?

1) To skip the execution of a block

2) To create an empty function

3) To terminate a loop

4) To raise an exception

Answer : To create an empty function

Which function is used to read a file in Python?

1) open()

2) read()

3) file()

4) load()

Answer : open()

How do you handle exceptions in Python?

1) try/except

2) catch/throw

3) handle/error

4) if/else

Answer : try/except

What is the output of print(bool(""))?

1) True

2) False

3) None

4) 0

Answer : False

Which operator is used to check if two values are equal in Python?

1) ==

2) =

3) !=

4) ===

Answer : ==

What is the output of print("Hello" + " World!")?

1) Hello World!

2) HelloWorld!

3) Hello + World!

4) HelloWorld

Answer : Hello World!

How do you define a variable in Python?

1) myVar = 10

2) var myVar = 10

3) myVar := 10

4) define myVar = 10

Answer : myVar = 10

What is the output of print(5 // 2)?

1) 2

2) 2.5

3) 3

4) 1

Answer : 2

How do you create a dictionary in Python?

1) myDict = {}

2) myDict = []

3) myDict = ()

4) myDict = dict()

Answer : myDict = {}