Q1:
2026: 31 May Shift 1
Computer Science
Exception Handling
Easy
Computer Science
Which of the following is correct syntax for handling exception in python?
2026: 31 May Shift 1
Computer Science
Exception Handling
Easy
Computer Science
Which of the following is correct syntax for handling exception in python?
2026: 31 May Shift 1
Computer Science
Exception Handling
Easy
Computer Science
Identify the incorrect statement about exception handling in python.
2026: 29 May Shift 2
Computer Science
Exception Handling
Easy
Computer Science
Each and every exception has to be handled by the programmer to avoid the program from crashing abruptly. This is done by writing additional code in a program to give proper messages or instructions to the user on encountering an exception. This process is known as _____________.
2026: 29 May Shift 2
Computer Science
Exception Handling
Easy
Computer Science
Match the LIST-I with LIST-II
| LIST-I | LIST-II | ||
|---|---|---|---|
| A. | ImportError | I. | Raised when the subscript in a sequence is out of range |
| B. | EOFError | II. | Raised when there is an error in the syntax of Python code |
| C. | IndexError | III. | Raised when the requested module definition is not found |
| D. | SyntaxError | IV. | Raised when the end of file condition is reached without reading any data by input() |
2026: 29 May Shift 2
Computer Science
Exception Handling
Easy
Computer Science
A / An_________ block will be executed only if exception is raised in the try block, in Python.
2026: 29 May Shift 1
Computer Science
Exception Handling
Easy
Computer Science
Name the built in exception when an operator is supplied with a value of incorrect data type.
2026: 29 May Shift 1
Computer Science
Exception Handling
Easy
Computer Science
________________ is detected when we have not followed the rules of the particular programming language while writing a program.
2026: 26 May Shift 1
Computer Science
Exception Handling
Easy
Computer Science
Match List-I with List-II
| List-I | List-II |
|---|---|
| (A) ImportError | (I) When an operator is supplied with a value of incorrect data type. |
| (B) IOError | (II) When the requested module defintion is not found. |
| (C) ValueError | (III) When the file specified in a program cannot be opened. |
| (D) TypeError | (IV) When an operation receives an argument having right data type but mismatched values. |
2026: 26 May Shift 1
Computer Science
Exception Handling
Medium
Computer Science
The sequence of steps of exception handling process is:
(A) Exception object is created
(B) Exception is raised
(C) An error is encountered in a method
(D) Runtime system searches for exception handler in the current method
2026: 26 May Shift 1
Computer Science
Exception Handling
Easy
Computer Science
To test an expression in a program code, _____ statement in python is used.
2026: 24 May Shift 1
Computer Science
Exception Handling
Easy
Computer Science
Which of the following statement is correct with respect to exception handling in python?
2026: 24 May Shift 1
Computer Science
Exception Handling
Easy
Computer Science
The 'raise' keyword in Python is used ____.
2026: 23 May Shift 2
Computer Science
Exception Handling
Easy
Computer Science
Which of the following is the correct way to raise a custom exception in Python?
2026: 23 May Shift 2
Computer Science
Exception Handling
Easy
Computer Science
Which of the following exception is raised when the requested module definition is not found?
2026: 23 May Shift 2
Computer Science
Exception Handling
Medium
Computer Science
Arrange the following steps of handling exceptions:
A. An error encountered in a method
B. Create exception object and exception is raised
C. Runtime system searches for exception handler in the current method
D. Catching an exception
2026: 23 May Shift 1
Computer Science
Exception Handling
Easy
Computer Science
Can a single try block have multiple except clauses in Python?
2026: 23 May Shift 1
Computer Science
Exception Handling
Medium
Computer Science
Which of the following statements are correct with respect to handling exceptions in Python?
A. The try block is used to catch exceptions.
B. The except block is executed if an exception occurs.
C. You can have multiple except blocks.
D. The else block executes if no exceptions occur.
2026: 21 May Shift 1
Computer Science
Exception Handling
Easy
Computer Science
Match List-I with List-II
| List-I | List-II |
|---|---|
| Description | Exception Handlers |
| (A) Built in Exception | (I) try block |
| (B) Throw an exception explicitly | (II) ValueError |
| (C) Suspicious code | (III) finally block |
| (D) Always executed regardless of exceptions | (IV) raise statement |
2026: 20 May Shift 1
Computer Science
Exception Handling
Easy
Computer Science
_______ statement in python is used to test an expression in the program code.
2026: 20 May Shift 1
Computer Science
Exception Handling
Easy
Computer Science
The statements inside ______ block are always executed whether an exception has occured in the try block or not.
2026: 19 May Shift 1
Computer Science
Exception Handling
Easy
Computer Science
Match List-I with List-II
| List-I Exception | List-II Description |
|---|---|
| (A) EOFError | (I) It is raised when mismatched or inappropriate values. |
| (B) NameError | (II) It is raised when an operator is supplied with a value of the incorrect data type. |
| (C) ValueError | (III) It is raised when the end of file condition is reached. |
| (D) TypeError | (IV) It is raised when a local or global variable name is not defined. |
2026: 19 May Shift 1
Computer Science
Exception Handling
Medium
Computer Science
Arrange the following Python Code in order:
(A) try:
numerator=50
denom=int(input("Enter the denominator: "))
quotient=(numerator/denom)
print ("Division performed successfully")
(B) finally:
print ("OVER AND OUT")
(C) else:
print ("The result of division operation is ", quotient)
(D) except ZeroDivisionError:
print ("Denominator as ZERO is not allowed")
2026: 18 May Shift 2
Computer Science
Exception Handling
Easy
Computer Science
Which of the following is an incorrect statement in the context to Exception handling in Python?
2026: 18 May Shift 2
Computer Science
Exception Handling
Easy
Computer Science
Which of the following are built-in exceptions in Python?
A. EOFError
B. IndentationError
C. TypeError
D. RaiseError
2026: 13 May Shift 2
Computer Science
Exception Handling
Medium
Computer Science
What will be the output of the following code (assumes that user enters 0 when denominator is being asked)?
print("Practicing for try block")
try:
numerator=50
denom=int(input("Enter the denominator"))
quotient=(numerator/denom)
print(quotient)
print("Division performed successfully")
except ZeroDivisionError:
print("Denominator as ZERO.... not allowed")
print(“OUTSIDE try..except block”)
2026: 13 May Shift 2
Computer Science
Exception Handling
Medium
Computer Science
Consider the code given below and fill in the blanks.
print("Learning Exceptions...")
try:
num1= int(input ("Enter the first number"))
num2=int(input("Enter the second number"))
quotient=(num1/num2)
print("Both the numbers entered were correct")
except ___________: # to enter only integers
print ("Please enter only numbers")
except __________: # Denominator should not be zero
print("Number 2 should not be zero")
else:
print("Great .. you are a good programmer")
_________: # to be executed at the end
print("JOB OVER... GO GET SOME REST")
2026: 11 May Shift 2
Computer Science
Exception Handling
Easy
Computer Science
Consider the code:
arr = [3, 2, 3]
print(arr[3])
Which of the following exception is raised?
2026: 11 May Shift 2
Computer Science
Exception Handling
Medium
Computer Science
Read the following statements related to exception handling and arrange them in the correct order.
A. Exception is raised
B. Executes the exception for catching an exception
C. Program searches for exception handler
D. Create exception object
E. An Error encountered
2026: 11 May Shift 2
Computer Science
Exception Handling
Easy
Computer Science
Which of the following statements are true about Try-Except-Else clause in Python?
A. Suspicious lines of codes are put inside a try block.
B. The except block is executed if an exception occurs.
C. You can have multiple except block to handle multiple exceptions.
D. The else block is executed when no exceptions are raised.
2025: 3 June Shift 2
Computer Science
Exception Handling
Easy
Computer Science
___________is raised when the result of calculation exceeds the maximum limit of numeric data type.