Any error condition or unexpected behavior in an executing program is known as an ________.
B. exception
Which of the following is not treated as a C# Exception?
A. You attempt to execute a C# program, but the C# compiler has not been installed.
Most exceptions you will use derive from three classes: _____.
A. Exception, SystemException, and ApplicationException
Exception objects can be ______.
B. both of these
When a program creates an Exception object, you ______.
A. can handle it
If you do not use object-oriented techniques, _________.
A. you can still manage error situations
In object-oriented terminology, you ______ a procedure that might not complete correctly.
D. try
In object-oriented terminology, a method that detects an error condition _____ an exception.
B. throws
When you write a block of code in which something can go wrong, and you want to throw an exception if it does, you place the code in a _______ block.
A. try
A catch block execute when its try block ______.
C. throws an Exception of an acceptable type
Which of the following catch blocks will catch any Exception object?
B. catch(Exception e) {}
Which of the following is valid within a catch block with the header catch(Exception error)?
C. two of these
You can place _____ statement(s) within a try block.
C. any number of
How many catch blocks might follow a try block within the same method?
B. any number, including zero or one
Consider the following try block. If x is 15, what is the value of a when this code completes?
try
{
a = 99;
if(x > 10)
throw(new Exception());
a = 0;
++a;
}
B. 99
Consider the following catch blocks. The variable b has been initialized to 0. If a DivideByZeroException occurs in a try block just before this catch block, what is the value of b when this code completes?
Consider the following catch blocks. The variable c has been initialized to 0. If an IndexOutOfRangeException occurs in a try block just before this catch block, what is the value of c when this code completes?
If your program throws an IndexOutOfRangeException, and the only available catch block catches an Exception, _______.
A. the Exception catch block executes
When you design your own classes that might cause exceptions, and other classes will use your classes as clients, you should usually create your methods to ________.
B. throw exceptions but not handle them
When you create an Exception subclass of your own, you should extend the _______ class.