0% found this document useful (0 votes)
7 views

mcq on exception handling

This document contains a set of multiple choice questions focused on Exception Handling in Python. It covers topics such as the number of except statements in a try-except block, the execution of else and finally blocks, and standard exceptions. The questions are designed to test knowledge of Python's exception handling mechanisms.

Uploaded by

afshan.affu05
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views

mcq on exception handling

This document contains a set of multiple choice questions focused on Exception Handling in Python. It covers topics such as the number of except statements in a try-except block, the execution of else and finally blocks, and standard exceptions. The questions are designed to test knowledge of Python's exception handling mechanisms.

Uploaded by

afshan.affu05
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

This set of Python Multiple Choice Questions & Answers (MCQs) focuses on

“Exception Handling”.

1. How many except statements can a try-except block have?

a) zero

b) one

c) more than one

d) more than zero

2. When will the else part of 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

3. Can one block of except statements handle multiple exception?

a) yes, like except Type Error, Syntax Error [,…]

b) yes, like except [Type Error, Syntax Error]

c) no

d) none of the mentioned

4. 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

5.. Which of the following is not an exception handling keyword in Python?

a) try

b) except

c) accept
d) finally

6. Which of the following statements is true?

a) The standard exceptions are automatically imported into Python programs

b) All raised standard exceptions must be handled in Python

c) When there is a deviation from the rules of a programming language, a


semantic error is thrown

d) If any exception is thrown in try block, else block is executed

7. Which of the following is not a standard exception in Python?

a) Name Error

b) IOError

c) Assignment Error

d) Value Error

8.Syntax errors are also known as parsing errors.

a) True

b) False

9.An exception is ____________

a) an object

b) a special function

c) a standard module

d) a module

10._______________________ exceptions are raised as a result of an error in


opening a particular file.

a) Value Error

b) Type Error

c) Import Error

d) IOError

11. Which of the following blocks will be executed whether an exception is


thrown or not?
a) except

b) else

c) finally

d) assert

You might also like