Unit 11 MIST 352 quiz
any number of
You can place ______________________ statement(s) within a try block.
throws an Exception of an acceptable type
A catch block executes when its try block ______________________.
exception
Any error condition or unexpected behavior in an executing program is known as an ______________________.
1
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? catch(DivideByZeroException e) {<br ++b; } catch(Exception e) { ++b; }
2
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? catch(IndexOutOfRangeException e) { ++c; } catch(Exception e) { ++c; } finally { ++c; }
99
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; }
both of these: generated automatically by C# and created by a program
Exception objects can be ______________________.
any number, including zero or one
How many catch blocks might follow a try block within the same method?
you can still manage error situations
If you do not use object-oriented techniques, ______________________.
the Exception catch block executes
If your program throws an IndexOutOfRangeException, and the only available catch block catches an Exception, ______________________.
throws
In object-oriented terminology, a method that detects an error condition ______________________ an exception.
try
In object-oriented terminology, you ______________________ a procedure that might not complete correctly.
Exception, SystemException, and ApplicationException
Most exceptions you will use derive from three classes: ______________________.
can handle it
When a program creates an Exception object, you ______________________.
exception
When you create an Exception subclass of your own, you should extend the ______________________ class.
throw exceptions but not handle them
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 ______________________.
try
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.
catch(Exception e) {}
Which of the following catch blocks will catch any Exception object?
You attempt to execute a C# program, but the C# compiler has not been installed.
Which of the following is not treated as a C# Exception?
two of these
Which of the following is valid within a catch block with the header catch(Exception error)?