Question: 7. Consider the following code: // Exception handling { std::cout < < STL exception time; double factor = 2.0; double val = factor*std::numeric_limits ::max(); //
7. Consider the following code:
// Exception handling
{
std::cout << "STL exception time";
double factor = 2.0;
double val
= factor*std::numeric_limits
{
double b = std::exp(val);
}
catch (std::domain_error& e)
{
// 1.
std::cout << "Error " << e.what() << std::endl;
}
catch (...)
{
// 2.
std::cout << "Unexpected error " << std::endl;
}
std::cout << "end " << std::endl;
}
When this code is run, what happens?
a) A domain error occurs.
b) An unexpected error occurs.
c) The program crashes.
d) The program runs to completion without throwing an exception.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
