🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: Exceptions and Files: all 15 questions

Quiz: Exceptions and Files · Question 6 of 15

What does this print? (code)

What does this print?

try:
    print(1 / 0)
except ZeroDivisionError:
    print("div")
else:
    print("else")
  1. A.div
  2. B.else
  3. C.div else
  4. D.An error
Answer & explanation

Correct answer: div

else runs only if there was no exception.

Can you get the rest right without peeking?

Take the timed Quiz: Exceptions and Files quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →