- Home
- MCQs by exam
- Python Interview Exception Handling
Python Interview Exception Handling MCQs
14 multiple choice questions typical of the Python Interview Exception Handling exam, with answers and explanations. Switch on practice mode to test yourself first.
What does raise ... from e do in Python?
What is the output of the following Python code snippet?
try:
1 / 0
except ZeroDivisionError:
print('Cannot divide by zero')
1 / 0
except ZeroDivisionError:
print('Cannot divide by zero')
What does a bare except: clause catch in Python?
What is the output of the following Python code snippet?
try:
print('A', end=' ')
except:
print('B', end=' ')
finally:
print('C')
print('A', end=' ')
except:
print('B', end=' ')
finally:
print('C')
What is the output of the following Python code snippet?
try:
int('x')
except (TypeError, ValueError):
print('caught')
int('x')
except (TypeError, ValueError):
print('caught')
What is the output of the following Python code snippet?
try:
assert 1 == 2
except AssertionError:
print('AssertionError')
assert 1 == 2
except AssertionError:
print('AssertionError')