Difficulty: Easy
Correct Answer: 4 and 5 only
Explanation:
Introduction / Context:This item probes practical exception-handling rules in C#: nesting, propagation between methods, and how exception objects carry data that catch blocks can inspect.
Given Data / Assumptions:
Concept / Approach:Statements (1)–(3) are common myths. C# supports nested try/catch/finally; you can use multiple try blocks in one method; and exceptions need not be caught where thrown—they may bubble up. Statements (4) and (5) reflect how exception objects are used in practice.
Step-by-Step Solution:
(1) False — nesting is legal and frequently used. (2) False — you may have several try blocks in one function. (3) False — exceptions can be caught in callers; only unhandled exceptions reach the runtime’s policy. (4) True — catch (ExType ex) lets you read ex.Message, ex.Data, custom properties, etc. (5) True — custom exceptions commonly add fields/auto-properties for multiple values (e.g., Expected, Actual).Verification / Alternative check:Create a custom exception with multiple properties; throw in one method, catch in another; read those properties inside catch successfully.
Why Other Options Are Wrong:Options A/B/C assert false constraints; option E marks all true when only (4) and (5) are true.
Common Pitfalls:Believing throws must be caught locally; forgetting you can add rich context to exceptions.
Final Answer:4 and 5 only
Discussion & Comments