1.

If classes produce some exceptions, then ______________________(a) Their respective catch block must be defined(b) Their respective catch blocks are not mandatory(c) Their catch blocks should be defined inside main function(d) Their catch blocks must be defined at the end of programI had been asked this question in an interview for internship.The question is from Catching Class Types topic in chapter Exception Handling & Static Class Members of Object Oriented Programming

Answer»

Correct choice is (a) Their respective catch BLOCK must be defined

The explanation: The catch blocks must be defined. This is to ensure that all the EXCEPTIONS related to the CLASSES are HANDLED by the program code and the program doesn’t terminate unexpectedly.



Discussion

No Comment Found

Related InterviewSolutions