Open In App
Related Articles

C++ | Exception Handling | Question 11

Improve
Improve
Improve
Like Article
Like
Save Article
Save
Report issue
Report
What happens in C++ when an exception is thrown and not caught anywhere like following program.
#include <iostream>
using namespace std;
  
int fun() throw (int)
{
    throw 10;
}
  
int main() {
  
  fun();
  
  return 0;
}
  

                    
(A) Compiler error (B) Abnormal program termination (C) Program doesn’t print anything and terminates normally (D) None of the above

Answer: (B)

Explanation: When an exception is thrown and not caught, the program terminates abnormally.

Quiz of this Question

Last Updated : 28 Jun, 2021
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads