Question
1.
#include
2.
using namespace std;
3.
double division(int a, int b)
4.
{
5.
if (b == 0)
6.
{
7.
throw "Division by zero condition!";
8.
}
9.
return (a / b);
10.
}
11.
int main ()
12.
{
13.
int x = 50;
14.
int y = 0;
15.
double z = 0;
16.
try
17.
{
18.
z = division(x, y);
19.
cout
What is the output of this program?
1.
#include
2.
using namespace std;
3.
double division(int a, int b)
4.
{
5.
if (b == 0)
6.
{
7.
throw "Division by zero condition!";
8.
}
9.
return (a / b);
10.
}
11.
int main ()
12.
{
13.
int x = 50;
14.
int y = 0;
15.
double z = 0;
16.
try
17.
{
18.
z = division(x, y);
19.
cout
Answer: Option C
Was this answer helpful ?
It's a mathematical certainty, We can't divide by zero, So we're arising a exception.
Output:
$ g++ excep.cpp
$ a.out
Division by zero condition!
Was this answer helpful ?
More Questions on This Topic :
Question 1.
Which is used to throw a exception?
....
Question 2.
What is the use of the 'finally' keyword?
....
Submit Solution