
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
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
10 questions
Kuis Dasar Koding dan AI

Quiz
•
12th Grade
20 questions
PTS Informatika Semester 2 2024-2025

Quiz
•
10th Grade - University
20 questions
BAB 4 SISTEM KOMPUTER KELAS 8

Quiz
•
8th Grade - University
Popular Resources on Wayground
10 questions
Lab Safety Procedures and Guidelines

Interactive video
•
6th - 10th Grade
10 questions
Nouns, nouns, nouns

Quiz
•
3rd Grade
10 questions
9/11 Experience and Reflections

Interactive video
•
10th - 12th Grade
25 questions
Multiplication Facts

Quiz
•
5th Grade
11 questions
All about me

Quiz
•
Professional Development
22 questions
Adding Integers

Quiz
•
6th Grade
15 questions
Subtracting Integers

Quiz
•
7th Grade
9 questions
Tips & Tricks

Lesson
•
6th - 8th Grade
Discover more resources for Information Technology (IT)
10 questions
9/11 Experience and Reflections

Interactive video
•
10th - 12th Grade
20 questions
Getting to know YOU icebreaker activity!

Quiz
•
6th - 12th Grade
10 questions
Impact of 9/11 and the War on Terror

Interactive video
•
10th - 12th Grade
28 questions
Ser vs estar

Quiz
•
9th - 12th Grade
6 questions
Biography

Quiz
•
4th - 12th Grade
25 questions
ServSafe Foodhandler Part 3 Quiz

Quiz
•
9th - 12th Grade
10 questions
Fact Check Ice Breaker: Two truths and a lie

Quiz
•
5th - 12th Grade
20 questions
Macromolecules

Quiz
•
9th - 12th Grade