Solved

Given the Following Code, What Will Happen If the Value \quad

Question 2

Multiple Choice

Given the following code, what will happen if the value of denom is 0?
double divide(int numer, int denom)
{
if (denom == 0)
\quad throw "ERROR: Cannot divide by zero.\n";
else
\quad Return static_cast<double>(numer) /denom;
}


A) Nothing will happen because there is no catch block.
B) The program will display ERROR: Cannot divide by zero.and then move to the statement following the if/else block.
C) The program will display ERROR: Cannot divide by zero.and then halt.
D) There is no throw point because there is no try block.
E) None of these

Correct Answer:

verifed

Verified

Related Questions