Solved

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

Question 15

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

Unlock this answer now
Get Access to more Verified Answers free of charge

Related Questions

Unlock this Answer For Free Now!

View this answer and more for free by performing one of the following actions

qr-code

Scan the QR code to install the App and get 2 free unlocks

upload documents

Unlock quizzes for free by uploading documents