Vidyalelo
C++ Programming · Q46

Exception Handling in C++

Programming · C++ Programming · question 46

Q46

What will be the output of the following C++ code? #include #include #include using namespace std; void func(int a, int b) if(b == 0) throw "This value of b will make the product zero. " "So please provide positive values. "; else cout<<"Product of "<<a<<" and "<<b<<" is: "<<a*b<<endl; int main() try func(5,0); catch(const char* e) cout<<e;

A.
0
B.
5
C.
This value of b will make the product zero. So please provide positive values.
Answer
D.
Product of 5 and 0 is: 0

Answer: Option C

Solution

Answer: Option C
No explanation is given for this question Let's Discuss on Board