Exception handling is not meant to handle problems for which case ?
(i) termination of program
(ii) handle return value representing error
(iii) hand return a legal value and leave the program in an illegal state
(iv) call an error handler function
MH SET - 2023, SET Exam - 2023,
Answer: C
The key is (iv) only, and the source behind it could not be traced.
The four items are the usual ways a program can deal with a run-time error without exceptions: terminate, return an error value, return a legal value and leave the program in an illegal state, or call an error-handler function. Exception handling is introduced as a replacement for those approaches, and the question asks which case it is not meant for. The key picks the call to an error handler function.
The wording is unclear. A search found a similar list of alternatives to exceptions in a C++ textbook but nothing that names (iv) as the one exception handling is not meant for, so the answer rests on the key. Options A, B and D each include (i), (ii) or (iii), which the key treats as cases exceptions do cover.
Please log in or register to report this question.