Difficulty: Easy
Correct Answer: 1, 2 and 3 only
Explanation:
Introduction / Context:
Solid exception handling requires knowing the runtime's behavior, the hierarchy of exception classes, and the structure of try/catch/finally. This question asks you to validate several common claims.
Given Data / Assumptions:
Concept / Approach:
(1) True: Uncaught exceptions are handled by the CLR, which reports and terminates the process. (2) True: You can define custom exceptions by deriving from System.Exception. (3) True: A catch (Exception) handler can catch any exception type unless filtering or rethrow occurs. (4) False: The base class is System.Exception, not “CLRExceptions”. (5) False: try can pair with catch alone or finally alone; a finally block is not mandatory for every try.
Step-by-Step Solution:
Verification / Alternative check:
Create MyException : Exception and throw it; catch (Exception) will handle it. Write try { } finally { } without catch; it compiles and runs.
Why Other Options Are Wrong:
Common Pitfalls:
Believing finally is mandatory or misnaming the root exception type. Also, catching Exception broadly should be used judiciously.
Final Answer:
1, 2 and 3 only
Discussion & Comments