Self-Review Exercises

  1. 13.1 Fill in the blanks in each of the following statements:

    1. A method is said to                an exception when it detects that a problem has occurred.

    2. When present, the                block associated with a try block always executes.

    3. Exception classes are derived from class               .

    4. The statement that throws an exception is called the                of the exception.

    5. C# uses the                model of exception handling as opposed to the                model of exception handling.

    6. An uncaught exception in a method causes the method to                from the methodcall stack.

    7. Method int.Parse can throw a(n)                exception if its argument is not a valid integer value.

    8. The                operator accesses a property or calls a method only if the operator’s left operand is not null.

    9. 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.

  2. 13.2 State whether each of the following is true or false. If false, explain why.

    1. Exceptions always are handled in the method that initially detects the exception.

    2. User-defined exception classes should extend class SystemException.

    3. Accessing an out-of-bounds array index causes the CLR to throw an exception.

    4. A finally block is optional after a try block that does not have any corresponding catch blocks.

    5. A finally block is guaranteed to execute.

    6. It’s possible to return to the throw point of an exception using keyword return.

    7. Exceptions can be rethrown.

    8. Property Message of class Exception returns a string indicating the method from which the exception was thrown.

    9. A when clause adds an exception filter to a catch clause.

    10. A nullable-type variable’s Value property always returns the underlying value.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset