Preview
IB DP Computer Science — B2 Programming — Programming fundamentals | SL | B2.1.3
📋 What You Will Learn
- Identify the potential points of failure in a program: unexpected inputs, resource unavailability, logic errors
- Describe the role of exception handling in developing robust programs
- Describe and use try/catch (Java) and try/except (Python) to manage errors
- Explain what the finally block guarantees and why it exists
- Predict which execution path a program takes for normal and failing inputs
🪢 Why This Matters Exception handling is the safety net under a trapeze act: it does not stop the fall, but it decides what happens next — a controlled recovery instead of a crash. The finally block is the stage crew who tidy up after the act whether the trick succeeded or not.
Where Programs Fail
📖 Definition — Exception An event raised during execution that disrupts the normal flow of instructions (e.g. dividing by zero, opening a missing file). If no code handles it, the program terminates with