InterviewSolution
Saved Bookmarks
| 1. |
Which of the following is an exception in C++?(a) Divide by zero(b) Semicolon not written(c) Variable not declared(d) An expression is wrongly writtenI had been asked this question in an interview.I would like to ask this question from Exception Handling topic in section Derived Classes, Templates & Exception Handling in C++ of C++ |
|
Answer» CORRECT answer is (a) Divide by ZERO Best explanation: EXCEPTIONS are those which are encountered during run-time of the program. semicolon, variable not declared and the wrong expression are compile-time ERRORS, therefore, they are not exceptions. Divide by zero is the PROBLEM that is encountered during run-time, therefore, it is an exception. |
|