Python - MCQ
Multiple Choice Questions
Python MCQ - File I/O Handling and Exception Handling - Set 39
16. When is the finally block executed?
A). when there is no exception
B). when there is an exception
C). only if some condition that has been specified is satisfied
D). always
View Answer
Correct: D
17. What will be the output of the following Python code?

A). 1
B). 2
C). 3
D). error, there is more than one return statement in a single try-finally block
View Answer
Correct: B
18. What will be the output of the following Python code?

A). 1 2
B). 1
C). 2
D). none of the mentioned
View Answer
Correct: A
19. What will be the output of the following Python code?

A). someError has occurred
B). someError has not occurred
C). invalid code
D). none of the mentioned
View Answer
Correct: C
20. What happens when ‘1’ == 1 is executed?
A). we get a True
B). we get a False
C). an TypeError occurs
D). a ValueError occurs
View Answer
Correct: B