1.

Which of the following keywords is used by the calling function to guard against the exception that is thrown by called function?(a) try(b) throw(c) throws(d) catchI got this question in unit test.This question is from Exceptions of Type Finally and Built in Exceptions topic in portion Indexers and Exception Handling of C#

Answer»

The CORRECT answer is (C) throws

The explanation is: If a method is capable of causing an EXCEPTION that it does not handle. It must specify this BEHAVIOUR so that callers of the method can guard themselves against that exception. This is DONE by using throws clause in methods declaration.



Discussion

No Comment Found

Related InterviewSolutions