Exception Handling Class 12 MCQ

Share with others

Exception Handling Class 12 MCQ, An exception is a Python object that represents an error. When an error occurs during the execution of a program, an exception is said to have been raised. Such an exception needs to be handled by the programmer so that the program does not terminate abnormally.

Exception Handling Class 12 MCQ

1. __ errors can occur when the programmer does not follow the rules of the particular programming language.
a. Syntax error
b. Runtime error
c. Logical error
d. None of the above

Show Answer ⟶
a. Syntax error

2. Which error is known as a parsing error?
a. Syntax error
b. Runtime error
c. Logical error
d. None of the above

Show Answer ⟶
a. Syntax error

3. Errors can be handled using a __.
a. Function
b. Variable
c. Exception
d. None of the above

Show Answer ⟶
c. Exception

4. __ raised when there is an error in the syntax of the Python code.
a. SyntaxError
b. IOError
c. ZeroDivisionError
d. TypeError

Show Answer ⟶
a. SyntaxError

5. __ error raised when the denominator in a division operation is zero.
a. SyntaxError
b. IOError
c. ZeroDivisionError
d. TypeError

Show Answer ⟶
c. ZeroDivisionError

6. __ error raised when the file specified in a program statement cannot be opened.
a. SyntaxError
b. IOError
c. ZeroDivisionError
d. TypeError

Show Answer ⟶
b. IOError

7. A programmer can create custom exceptions to suit one’s requirements; it is known as _.
a. Predefined exceptions
b. User-defined exceptions
c. Custom exceptions
d. None of the above

Show Answer ⟶
b. User-defined exceptions

8. What is the purpose of the ‘raise’ statement in Python?
a. To handle exceptions
b. For log error
c. To explicitly trigger an exception
d. None of the above

Show Answer ⟶
c. To explicitly trigger an exception

9. Which of the following is a correct syntax of the ‘raise’ statement?
a. raise(‘Error message’)
b. raise Exception(‘Error message’)
c. Both a) and b)
d. None of the above

Show Answer ⟶
b. raise Exception(‘Error message’)

10. Which statement in Python is used to test an expression in the program code?
a. raise statement
b. assert statement
c. Both a) and b)
d. None of the above

Show Answer ⟶
b. assert statement

11. Writing additional code in a program to give proper messages or instructions to the user on encountering an exception. This process is known as _.
a. Error handling
b. Exception handling
c. Raise handling
d. Assert handling

Show Answer ⟶
b. Exception handling

12. In exception handling, when an error occurs, the Python interpreter creates an object called __.
a. Error object
b. Exception object
c. Assert object
d. Raise object

Show Answer ⟶
Exception object

13. Exception object contain which type of information.
a. Error type
b. file name
c. Error position in the program
d. All of the above

Show Answer ⟶
d. All of the above

14. This process of creating an exception object and handing it over to the runtime system is called _.
a. Error an exception
b. Throwing an exception
c. Handling an exception
d. None of the above

Show Answer ⟶
b. Throwing an exception

15. Every try block is followed by an __ block.
a. Type
b. Size
c. Except
d. None of the above

Show Answer ⟶
c. Except

Disclaimer: We have taken an effort to provide you with the accurate handout of “Exception Handling Class 12 MCQ“. If you feel that there is any error or mistake, please contact me at anuraganand2017@gmail.com. The above CBSE study material present on our websites is for education purpose, not our copyrights. All the above content and Screenshot are taken from Computer Science Class 12 CBSE Textbook, Sample Paper, Old Sample Paper, Board Paper and Support Material which is present in CBSEACADEMIC website, This Textbook and Support Material are legally copyright by Central Board of Secondary Education. We are only providing a medium and helping the students to improve the performances in the examination. 

Images and content shown above are the property of individual organizations and are used here for reference purposes only.

For more information, refer to the official CBSE textbooks available at cbseacademic.nic.in

cbseskilleducation


Share with others

Leave a Comment