Exception Handling: Show Must Go On! 371
B. Output of Programs
1. Divide by Zero Error.
2. Expected 'catch' before '}' token
3. Radius must be greater than 0.
4. The circumference of circle is 62
5. Radius must be greater than 0
G. What happens if an exception is thrown from an object’s destructor?
H. What are the costs and benefits of using exceptions?
I. When would you choose to return an error code rather than throw an exception?
J. Write a program to calculate area of a rectangle. Use exception handling to check the sides of the
rectangle.
K. Write a program to implement stack. Use exception handling.
Answers
A. True/False
1. True 2. True 3. False 4. True
5. True 6. False 7. True 8. False
9. True 10. True
M08_MOTHXXXX_01_SE_C08.indd ...