Back to the full dot-point answer
SingaporeComputer ScienceQuick questions
Programming and Software Development
Quick questions on Exception handling and file input-output explained: H2 Computing
3short Q&A pairs drawn directly from our worked dot-point answer. For full context and worked exam questions, read the parent dot-point page.
What is catching the right exception?Show answer
Catch specific exception types you expect and can handle. A bare except: that catches everything also swallows bugs, typos and unexpected failures, hiding problems and complicating debugging. Be precise:
What is q1?Show answer
What is the purpose of the finally block? [1 mark]
What is q2?Show answer
Why is catching a specific exception better than a bare except? [2 marks]
Have a question we have not covered?
This dot-point answer is short enough that we have not extracted many short questions yet. Read the full dot-point answer or ask Mo, our study assistant, in the chat for follow ups.