Google News
logo
CPP - Quiz(MCQ)
Why do we need to handle exceptions in C++?
A)
To get correct output
B)
To successfully compile the program
C)
To avoid unexpected behaviour of a program during run-time
D)
To let compiler remove all exceptions by itself

Correct Answer :   To avoid unexpected behaviour of a program during run-time


Explanation : We need to handle exceptions in a program to avoid any unexpected behaviour during run-time because that behaviour may affect other parts of the program. Also, an exception is detected during run-time, therefore, a program may compile successfully even with some exceptions cases in your program.

Advertisement