SY0-301 · Question #81
Which of the following pseudocodes can be used to handle program exceptions?
The correct answer is C. If program module crashes, then restart program module.. Exception handling is the process of detecting a runtime error or unexpected condition and responding to it gracefully to keep the program functional. Option C - 'If program module crashes, then restart program module' - is a textbook example: it detects a failure event (module c
Question
Which of the following pseudocodes can be used to handle program exceptions?
Options
- AIf program detects another instance of itself, then kill program instance.
- BIf user enters invalid input, then restart program.
- CIf program module crashes, then restart program module.
- DIf user's input exceeds buffer length, then truncate the input.
How the community answered
(30 responses)- A7% (2)
- B3% (1)
- C90% (27)
Explanation
Exception handling is the process of detecting a runtime error or unexpected condition and responding to it gracefully to keep the program functional. Option C - 'If program module crashes, then restart program module' - is a textbook example: it detects a failure event (module crash) and takes a corrective action (restart the module) to recover. Option A describes process management (killing a duplicate instance). Option B describes input validation with a restart response, not true exception handling. Option D describes input sanitization to prevent buffer overflows - also input validation, not exception handling.
Topics
Community Discussion
No community discussion yet for this question.