Test Index
Exception Handling in Python
© examsnet.com
Question : 5 of 5
Marks:
+1,
-0
State whether the following statement is True or False :While handling exceptions in Python, name of the exception has to be compulsorily added with
except clause.[CBSE 2024 Set 4]
Solution:
Concept:An
except clause can be written without an exception name. Such a bare except: catches every exception.Explanation:try: x = int(input("Enter a number: ")) print(10 / x)except ZeroDivisionError: print("Cannot divide by zero")except: print("Some other error")The name is needed only when a particular exception has to be handled separately. So the statement is False.Answer:Option B (False)© examsnet.com
Go to Question: