Vidyalelo
C++ Programming · Q499

C++ miscellaneous

Programming · C++ Programming · question 499

Q499

What will be the output of the following C++ code? #include using namespace std; int main() double a = 10, b = 5, res; char Operator = '/'; try if (b == 0) throw "Division by zero not allowed"; res = a / b; cout << a << " / " << b << " = " << res; catch(const char* Str) cout << " Bad Operator: " << Str; return 0;

A.
10
B.
2
C.
Bad Operator
D.
10 / 5 = 2
Answer

Answer: Option D

Solution

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