Q1:
2025: 3 June Shift 2
Computer Science
Exception Handling
Easy
Computer Science
What is an exception in Python?
2025: 3 June Shift 2
Computer Science
Exception Handling
Easy
Computer Science
What is an exception in Python?
2025: 3 June Shift 2
Computer Science
Exception Handling
Easy
Computer Science
What happens if multiple except blocks are written for the same try block?
2025: 30 May Shift 2
Computer Science
Exception Handling
Easy
Computer Science
Identify the incorrect built in exception from the following:
2025: 30 May Shift 2
Computer Science
Exception Handling
Medium
Computer Science
Arrange the steps of handling exceptions in order:
(A) The exception object is handed over to the runtime system so that it can find an appropriate code to handle this particular exception.
(B) If the runtime system is not able to find an appropriate exception after searching all the methods in the call stack, then the program execution stops.
(C) The runtime system searches the entire program for a block of code, called the exception handler that can handle the raised exception.
(D) When an error occurs, Python interpreter creates an object called the exception object.
2025: 27 May Shift 2
Computer Science
Exception Handling
Easy
Computer Science
Write the following Python Program in correct sequence ?
(A) print("Handling exception using try...except...else")
(B) except ZeroDivisonError:
print("Denominator as zero is not allowed")
(C) else :
print("the result of division operation is quotient")
(D)try :
numerator =50
denom=int(input("enter the denominator:"))
quotient=(numerator/denom)
print("Division performed successfully")
2025: 27 May Shift 2
Computer Science
Exception Handling
Medium
Computer Science
When an exception is raised, ___________ type of built-in-exception occurs.
(A) SyntaxError
(B) ValueError
(C) KeyBoardInterruptError
(D) NameError
2025: 22 May Shift 1
Computer Science
Exception Handling
Easy
Computer Science
Arrange the given keywords in the blank spaces in the correct order of their appearance in the code.
try:
n1= int(input("Enter first number"))
n2= int(input("Enter second number"))
quotient= (n1/n2)
except __________:
print("Please enter numbers only")
except __________:
print("n2 can not be zero")
____:
print("Something went wrong")
____:
print( "Bye")
(A). ZeroDivisionError
(B). ValueError
(C). except
(D). finally
2025: 21 May Shift 1
Computer Science
Exception Handling
Easy
Computer Science
Sequence the correct order of operations in a comprehensive exception handling structure in Python:
(A) Ensure the execution of cleanup or final steps in the finally block.
(B) Handle exceptions in the subsequent except blocks.
(C) Execute the try block where errors might occur.
(D) Use the else block for code that executes if no exception occurs.
2025: 21 May Shift 1
Computer Science
Exception Handling
Easy
Computer Science
Match List-I with List-II
| List-I | List-II |
|---|---|
| (A) try | (I) Handles specific errors that may occur. |
| (B) except | (II) Block where exceptions are checked. |
| (C) finally | (III) Block that executes regardless of preceding block results. |
| (D) raise | (IV) Used to manually trigger an exception. |
2025: 21 May Shift 1
Computer Science
Exception Handling
Medium
Computer Science
Out of the following statements, which one is incorrect in the context of exceptions in Python?
2025: 20 May Shift 1
Computer Science
Exception Handling
Easy
Computer Science
______ is raised when the file specified in a program statement cannot be opened.
2025: 16 May Shift 1
Computer Science
Exception Handling
Easy
Computer Science
Which of the following is not a built-in exception in python?
2025: 16 May Shift 1
Computer Science
Exception Handling
Easy
Computer Science
Consider the following code:
___:
num=50
demon= int(input("Enter the denominator"))
quotient=(num/denom)
print("Division done")
____ZeroDivisionError:
print("Denominator is zero...not allowed")
___:
print("The result of division sis", quotient)
___:
print("Completed")
Arrange the following keywords to be filled in the blank spaces of the above code.
(A) else
(B) except
(C) finally
(D) try
2025: 16 May Shift 1
Computer Science
Exception Handling
Easy
Computer Science
_____________block will only be executed if some exception is raised in the _____________block.
2025: 15 May Shift 2
Computer Science
Exception Handling
Easy
Computer Science
The statements inside the _____ block are always executed regardless of whether an exception has occurred or not.
2025: 15 May Shift 2
Computer Science
Exception Handling
Easy
Computer Science
Identify the type of error shown in the code:
print(10 + '5')
2025: 15 May Shift 2
Computer Science
Exception Handling
Easy
Computer Science
Name the built in exception raised when an operator is supplied with a value of incorrect data type.
2025: 14 May Shift 1
Computer Science
Exception Handling
Easy
Computer Science
Match List-I with List-II
| List-I | List-II |
|---|---|
| (A) NameError | (I) raised when a built-in method receives an argument that has the right data type but mismatched values. |
| (B) IndexError | (II) raised when an operator is supplied with a value of incorrect data type. |
| (C) TypeError | (III) raised when subscript in a sequence is out of range. |
| (D) ValueError | (IV) raised when a local or global variable name is not defined. |
2025: 14 May Shift 1
Computer Science
Exception Handling
Medium
Computer Science
Arrange the following in the correct order of handling exceptions.
(A) Exception is raised.
(B) Run time system searches for exception handler in the current method.
(C) An Error encountered in a method.
(D) Create Exception Object.