Quiz on Python Exception Handling
FREE Online Courses: Enroll Now, Thank us Later!
Quiz Summary
0 of 15 Questions completed
Questions:
Information
You have already completed the quiz before. Hence you can not start it again.
Quiz is loading…
You must sign in or sign up to start the quiz.
You must first complete the following:
Results
Results
0 of 15 Questions answered correctly
Your time:
Time has elapsed
You have reached 0 of 0 point(s), (0)
Earned Point(s): 0 of 0, (0)
0 Essay(s) Pending (Possible Point(s): 0)
Categories
- Not categorized 0%
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- Current
- Review / Skip
- Answered
- Correct
- Incorrect
-
Question 1 of 15
1. Question
- Which of the following is not an exception in Python?
CorrectIncorrect -
Question 2 of 15
2. Question
- What is the error raised when a built-in function is inputted with invalid data type values?
CorrectIncorrect -
Question 3 of 15
3. Question
- What is the output of the below code?
-
n=5
try:
print(n,end=”)
print(‘!’,end=”)
except:
print(‘!’)
CorrectIncorrect -
Question 4 of 15
4. Question
- Find the output of the below code.
name=’Python’
try:
print(Name,end=”)
except:
print(“Exception”,end=”)
print(“!”)
CorrectIncorrect -
Question 5 of 15
5. Question
- Which of the following is the base class for all errors related to the numeric calculation?
CorrectIncorrect -
Question 6 of 15
6. Question
- What is the output of the below code?
-
try:
print([1,2,3,4][4])
except Exception as ex:
print(ex)
CorrectIncorrect -
Question 7 of 15
7. Question
- What is the output of the below code?
-
try:
div=5/0
except (ZeroDivisionError,TypeError) as e:
print(e)
except Exception as e:
print(e)
CorrectIncorrect -
Question 8 of 15
8. Question
- Which of the following error is raised when we give the below code?
- raise
CorrectIncorrect -
Question 9 of 15
9. Question
- What is the output of the below code?
try:
name=Python
except SyntaxError:
print(‘E1’)
except NameError:
print(‘E2’)
CorrectIncorrect -
Question 10 of 15
10. Question
- Which of the following is the correct way to raise a SyntaxError with a message?
CorrectIncorrect -
Question 11 of 15
11. Question
- Find the output of the below code.
try:
n=0
assert n>0
raise
except:
print(“Exception”)
CorrectIncorrect -
Question 12 of 15
12. Question
- Which of the following is true about the code under finally block?
CorrectIncorrect -
Question 13 of 15
13. Question
- What is the output of the below code?
-
num=4
try:
div=num//2
except:
print(“Exception”)
else:
print(div)
CorrectIncorrect -
Question 14 of 15
14. Question
- What is the output of the below code?
assert False
CorrectIncorrect -
Question 15 of 15
15. Question
- What is the exception raised in the below code?
-
class MyException(Exception):
print(‘Exception’)
raise MyException
CorrectIncorrect