Recall & Review
beginner
What is the base class for all exceptions in .NET?The base class for all exceptions in .NET is <strong>System.Exception</strong>. All other exceptions inherit from this class.Click to reveal answer
intermediate
What is the difference between
System.Exception and System.SystemException?<code>System.Exception</code> is the root class for all exceptions. <code>System.SystemException</code> is a subclass used for exceptions thrown by the runtime, like <code>NullReferenceException</code> or <code>IndexOutOfRangeException</code>.Click to reveal answer
intermediate
Name two common subclasses of
System.SystemException.Two common subclasses of
System.SystemException are NullReferenceException and IndexOutOfRangeException. These are used for runtime errors.Click to reveal answer
beginner
What is the purpose of
System.IO.IOException in the exception hierarchy?<code>System.IO.IOException</code> is a subclass of <code>System.Exception</code> that handles errors related to input/output operations, such as file access problems.Click to reveal answer
beginner
Why should you catch specific exceptions instead of catching
System.Exception directly?Catching specific exceptions helps you handle different error types properly and avoid hiding unexpected errors. Catching
System.Exception can make debugging harder and may catch exceptions you don't intend to handle.Click to reveal answer
Which class is the direct parent of
System.NullReferenceException?✗ Incorrect
System.NullReferenceException inherits from System.SystemException, which is for runtime exceptions.Which exception class should you use for errors caused by invalid arguments?
✗ Incorrect
System.ArgumentException is used when a method receives an invalid argument.What is the root class of all exceptions in .NET?
✗ Incorrect
System.Exception is the root class for all exceptions.Which exception type is best for handling file read/write errors?
✗ Incorrect
System.IO.IOException is designed for input/output errors like file access.Why is catching
System.Exception generally discouraged?✗ Incorrect
Catching
System.Exception can hide unexpected errors and make debugging difficult.Explain the main branches of the exception hierarchy in .NET and their purposes.
Think about runtime vs application exceptions.
You got /4 concepts.
Describe why it is important to catch specific exceptions rather than the base Exception class.
Consider what happens if you catch everything at once.
You got /4 concepts.