Which of the following is an exception in C++?

Kim Thu Đoàn

New member
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 written
 
Answer: a
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.
 

Tìm kiếm

Back
Top