
Python Exception Handling Quiz

Quiz
•
Information Technology (IT)
•
12th Grade
•
Hard
Ali Fakhri
FREE Resource
15 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
20 sec • 1 pt
What is the purpose of the try-except block in Python?
To import modules
To handle exceptions
To define a function
To create a loop
2.
MULTIPLE CHOICE QUESTION
20 sec • 1 pt
Which exception is raised when a variable name is not found?
IndexError
ValueError
NameError
TypeError
3.
MULTIPLE CHOICE QUESTION
20 sec • 1 pt
What does the finally block do in exception handling?
It terminates the program
It defines a new exception
It executes regardless of an exception
It executes only if an exception occurs
4.
MULTIPLE CHOICE QUESTION
20 sec • 1 pt
Which of the following exceptions is raised when dividing by zero?
TypeError
IndexError
ValueError
ZeroDivisionError
5.
MULTIPLE CHOICE QUESTION
20 sec • 1 pt
What will happen if an exception is not caught?
The program will crash
The program will continue running
The program will restart
The program will ignore the error
6.
MULTIPLE CHOICE QUESTION
20 sec • 1 pt
Which exception is raised when trying to access an out-of-range index in a list?
IndexError
NameError
KeyError
AttributeError
7.
MULTIPLE CHOICE QUESTION
20 sec • 1 pt
What is the output of the following code: 'x = 5; y = 'hello'; z = x + y'?
TypeError
None
Error: cannot add an int and a str
5hello
Create a free account and access millions of resources
Similar Resources on Wayground
10 questions
Kuis Dasar Koding dan AI

Quiz
•
12th Grade
20 questions
C-Quiz-01

Quiz
•
9th - 12th Grade
20 questions
BAB 4 SISTEM KOMPUTER KELAS 8

Quiz
•
8th Grade - University
10 questions
Quiz Assesmen Awal "Perangkat Keras"

Quiz
•
7th Grade - University
20 questions
Quiz Komputasional-Struktur Data kelas 9

Quiz
•
9th Grade - University
10 questions
Basic Logic & Programming pt.2

Quiz
•
6th Grade - University
10 questions
Pengenalan Profesi Bidang PPLG

Quiz
•
10th Grade - University
15 questions
Review Time

Quiz
•
11th Grade - University
Popular Resources on Wayground
10 questions
Video Games

Quiz
•
6th - 12th Grade
20 questions
Brand Labels

Quiz
•
5th - 12th Grade
15 questions
Core 4 of Customer Service - Student Edition

Quiz
•
6th - 8th Grade
15 questions
What is Bullying?- Bullying Lesson Series 6-12

Lesson
•
11th Grade
25 questions
Multiplication Facts

Quiz
•
5th Grade
15 questions
Subtracting Integers

Quiz
•
7th Grade
22 questions
Adding Integers

Quiz
•
6th Grade
10 questions
Exploring Digital Citizenship Essentials

Interactive video
•
6th - 10th Grade
Discover more resources for Information Technology (IT)
20 questions
Brand Labels

Quiz
•
5th - 12th Grade
10 questions
Video Games

Quiz
•
6th - 12th Grade
28 questions
Ser vs estar

Quiz
•
9th - 12th Grade
13 questions
BizInnovator Startup - Experience and Overview

Quiz
•
9th - 12th Grade
16 questions
AP Biology: Unit 1 Review (CED)

Quiz
•
9th - 12th Grade
20 questions
Parallel lines and transversals

Quiz
•
9th - 12th Grade
9 questions
Geometry and Trigonometry Concepts

Interactive video
•
9th - 12th Grade
10 questions
Angle Relationships with Parallel Lines and a Transversal

Quiz
•
9th - 12th Grade