Python - MCQ

Multiple Choice Questions


Share with a Friend

 

Python MCQ - File I/O Handling and Exception Handling - Set 38

11. How many except statements can a try-except block have? 
A). zero
B). one
C). more than one
D). more than zero
View Answer
Correct: D


12. When will the else part of the try-except-else be executed? 
A). always
B). when an exception occurs
C). when no exception occurs
D). when an exception occurs in to except block
View Answer
Correct: C


13. Is the following Python code valid? 

A). no, there is no such thing as finally
B). no, finally cannot be used with except
C). no, finally must come before except
D). yes
View Answer
Correct: B


14. Is the following Python code valid? 

A). no, there is no such thing as else
B). no, else cannot be used with except
C). no, else must come before except
D). yes
View Answer
Correct: D


15. Can one block of except statements handle multiple exceptions? 
A). yes, like except TypeError, SyntaxError [,…]
B). yes, like except [TypeError, SyntaxError]
C). no
D). none of the mentioned
View Answer
Correct: A



 
 
 
   
   
   
UltraInfo Technologies
ITDeveloper