WorksheetsNetligent Exception
Total questions: 18
Worksheet time: 10mins
Exception disrupts the
Normal flow of the program
Abnornal flow of the program
Hard Disk
None of the Above
The suspicious code is put inside the
Try Block
Finally Block
Else Block
Except Block
________ statement can also be used without specifying Exception.
Try
Finally
Except
Else
try:
a=10/5
print (a)
except ArithmeticError:
print ("This statement is raising an exception" )
finally:
print (" final block executed " )
2.0
final block executed
This statement is raising an exception
final block executed
final block executed
2.0
An exception can be manually triggered by the command
raise
try
except
trigger
User defined Exceptions are created from the _________ Parent Class
Exception
Except
Handler
User Defined Exception
How many except statements can a try-except block have?
zero
one
more than one
more than zero
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
Is the following Python code valid?
try:
# Do something
except:
# Do something
else:
# Do something
no, there is no such thing as else
no, else cannot be used with except
no, else must come before except
yes
What will be the output of the following Python code?
lst = [1, 2, 3]
lst[3]
a) NameError
b) ValueError
c) IndexError
d) TypeError
How many except statements can a try-except block have?
Zero
One
More than One
More than Zero
When is the finally block executed?
when an exception occurs
when no exception occurs
never
always
Can one except block handle multiple exceptions?
Yes
No
May be
Insufficient information
Which of the following is correct regarding exception
That may occur any time
That occurs before execution
That occurs after execution
That occurs during execution
Exception handling in python is done using ___ blocks
try
except
else
finally
What is the output of the attached python code?
Value error
Finally done
Type error
Finally done
Type error
Value error
What is the output of the attached python code?
Function name error
Sum finally
Invocation finally
Invocation name error
Invocation finally
Sum finally
Invocation name error
Invocation finally
Function name error
Sum finally
What is the output of the attached python code?
100
0
Zero Division Error Occurred
Another error will occur, program will "crash"
