Revision Quiz 1

Revision Quiz 1

12th Grade

40 Qs

quiz-placeholder

Similar activities

PENILAIAN AKHIR SEMESTER PWPB XII

PENILAIAN AKHIR SEMESTER PWPB XII

12th Grade

40 Qs

BES 2 - Seatwork 8

BES 2 - Seatwork 8

12th Grade

40 Qs

Ôn Tập Chuong III - Tin 11

Ôn Tập Chuong III - Tin 11

6th Grade - University

40 Qs

Python - Lists, Dictionaries and Loops

Python - Lists, Dictionaries and Loops

9th - 12th Grade

40 Qs

Python Unit 11 - Collections: Dictionary, List, Set, Tuple

Python Unit 11 - Collections: Dictionary, List, Set, Tuple

6th - 12th Grade

40 Qs

Python Review

Python Review

8th - 12th Grade

35 Qs

Informatica teorica

Informatica teorica

12th Grade

43 Qs

Python

Python

8th - 12th Grade

40 Qs

Revision Quiz 1

Revision Quiz 1

Assessment

Quiz

Computers

12th Grade

Medium

Created by

Harmeet Kaur

Used 1+ times

FREE Resource

40 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which block executes whether or not an exception occurs in Python?
try
except
finally
else
raise

Answer explanation

The finally block always executes.

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What exception is raised when converting 'abc' to int using int('abc')?
TypeError
ValueError
NameError
IndexError
RuntimeError

Answer explanation

Invalid literal for int() raises ValueError.

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Select the correct order of blocks in Python exception handling:
try → except → finally
try → finally → except
except → try → finally
try → else → finally (without except)
else → try → except

Answer explanation

Basic pattern is try/except/finally; else is optional between except and finally.

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which statement will manually trigger an exception?
throw Exception()
raise Exception()
rise Exception()
error()
assert False()

Answer explanation

Python uses raise to throw exceptions.

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What does the else block in try/except/else indicate?
Runs only if an exception occurs
Runs only if no exception occurs
Always runs
Runs only after finally
Is required with finally

Answer explanation

else runs when no exception is raised in try.

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What exception is most appropriate for division by zero?
ArithmeticError
ZeroDivisionError
OverflowError
ValueError
TypeError

Answer explanation

ZeroDivisionError is a subclass of ArithmeticError.

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which exception is raised by list index out of range?
KeyError
IndexError
LookupError
ValueError
RangeError

Answer explanation

IndexError occurs for invalid indices; it's a LookupError subclass.

Create a free account and access millions of resources

Create resources
Host any resource
Get auto-graded reports
or continue with
Microsoft
Apple
Others
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?