13.1 Fill in the blanks in each of the following statements:
A method is said to an exception when it detects that a problem has occurred.
When present, the block associated with a try
block always executes.
Exception classes are derived from class .
The statement that throws an exception is called the of the exception.
C# uses the model of exception handling as opposed to the model of exception handling.
An uncaught exception in a method causes the method to from the methodcall stack.
Method int.Parse
can throw a(n) exception if its argument is not a valid integer value.
The operator accesses a property or calls a method only if the operator’s left operand is not null
.
An expression using the operator evaluates to the operator’s left operand if it’s not null
; otherwise, the expression evaluates to the operator’s right operand.
13.2 State whether each of the following is true or false. If false, explain why.
Exceptions always are handled in the method that initially detects the exception.
User-defined exception classes should extend class SystemException
.
Accessing an out-of-bounds array index causes the CLR to throw an exception.
A finally
block is optional after a try
block that does not have any corresponding catch
blocks.
A finally
block is guaranteed to execute.
It’s possible to return to the throw point of an exception using keyword return
.
Exceptions can be rethrown.
Property Message
of class Exception
returns a string
indicating the method from which the exception was thrown.
A when
clause adds an exception filter to a catch
clause.
A nullable-type variable’s Value
property always returns the underlying value.