Question
#include <iostream>
using namespace std;
double division(int a, int b)
{
if (b == 0)
{
throw "Division by zero condition!";
}
return (a / b);
}
int main ()
{
int x = 50;
int y = 2;
double z = 0;
try
{
z = division(x, y);
cout << z;
}
catch(const char *msg)
{
cerr << msg;
}
return 0;
}
a.
25
b.
20
c.
Division by zero condition!
d.
None of the mentioned
Posted under Object Oriented Programming Using C++
Engage with the Community - Add Your Comment
Confused About the Answer? Ask for Details Here.
Know the Explanation? Add it Here.
Q. What is the output of this program?
Similar Questions
Discover Related MCQs
Q. What will happen when the exception is not caught in the program?
View solution
Q. Which key word is used to check exception in the block of code?
View solution
Q. To where does the program control transfers when exception is arised?
View solution
Q. Which keyword is used to access the variable in namespace?
View solution
Q. What is the general syntax for accessing the namespace variable?
View solution
Q. What is the use of Namespace?
View solution
Q. Identify the correct statement.
View solution
Q. Which operator is used to signify the namespace?
View solution
Suggested Topics
Are you eager to expand your knowledge beyond Object Oriented Programming Using C++? We've curated a selection of related categories that you might find intriguing.
Click on the categories below to discover a wealth of MCQs and enrich your understanding of Computer Science. Happy exploring!