Vidyalelo
Python · all questions

Exception Handling in Python
practice.

Practice every MCQ with options. Use Show answers when you want the correct option and solution.

65

Questions

4/4

Page

Pick an option on a question to see the right answer and solution.

Which of the following blocks will be executed whether an exception is thrown or not?

Select an option to see the answer and solution.

. . . . . . . . exceptions are raised as a result of an error in opening a particular file.

Select an option to see the answer and solution.

What will be the output of the following Python code?
t[5]

Select an option to see the answer and solution.

What happens if the file is not found in the following Python code?
a=False
while not a:
    try:
        f_n = input("Enter file name")
        i_f = open(f_n, 'r')
    except:
        print("Input file not found")

Select an option to see the answer and solution.

Which of the following is true about the finally clause in exception handling?

Select an option to see the answer and solution.