CISP 10-Chapter 10
______ is thrown when you attempt to store an object that is the wrong data type in an array.
ArrayOutOfRangeException
The memory location known as the _____ is where the computer stores the list of method locations to which the system must return
Call stack
A catch block has no return type and _______ be called directly
Cannot
A ________ is a segment of code that can handle an exception that might be thrown by the try block that preceded it.
Catch block
The block of code that processes an error in exception handling " ________."
Catches the exception
Exceptions can be particularly useful when you throw them from ______, which do not have a return type, so they have no other way to send information back to the calling method.
Constructors
A(n) _________ statement indicates the end of the catch block in the pseudocode.
Endcatch
A(n) _____ is an unexpected or error condition that occurs while a program is running.
Exception
In Java, an ArithmeticException is a type of _______.
Exception
To create your own throwable Exception, you usually extend a built-in __________ class.
Exception
When appropriate, specialized _______ classes provide an elegant way for you to handle error situations.
Exception
When you create an exception, it is conventional to end its name with ______.
Exception
The object-oriented techniques to manage errors, such as dividing a value by 0, comprise the group of methods known as ______.
Exception handling
An ______ indicates exception types that might be thrown in the method header.
Exception specification clause
A catch block consists of four different elements: the key catch, followed by parentheses that contain an exception type and identifier, statements that take action to handle the error condition, an endcatch statement, and a return statement.
False
Using a traditional error-handling method to avoid dividing by 0 prevents the error and makes the method more flexible.
False
When a program throws an exception, you always have to deal with it.
False
When illegal division by 0 takes place, an exception object is not created automatically by the object-oriented language application.
False
When you create a segment of code in which something might go wrong, you place the code in an error block.
False
You can only place one statement within each try block.
False
The ____ block is used when the program uses data files that must be closed.
Finally
If method A calls method B and method B throws an exception, which method will catch the exception, assuming all methods have a catch block?
Method B
______ is thrown when an object reference does not correctly refer to a created object.
NullReferenceException
_______ is thrown when an arithmetic operation produces a result for which the value is greater than the assigned memory location can accommodate.
OverFlowException
By inheriting from the Exception class, you gain access to methods contained in the _______.
Parent class
Methods are flexible partly because they are ______.
Reusable
A ______ is one that sends an exception object of a method so it can be handled elsewhere.
Throw statement
When a method in an object-oriented program causes an exception, such as dividing by 0, the method _______.
Throws the exception
A system of passing exceptions through the chain of calling methods has great advantages because it allows methods to handle exceptions whenever the programmer has decided it is most appropriate.
True
Dividing by 0 is an error in every programming language because it is an operation that is not defined mathematically.
True
Probably the most often used error-handling solution before object-oriented programming was to make a decision before working with a potentially error-causing value.
True
You can create your own exceptions.
True
In object-oriented terminology, you " _______" a segment of code that might cause an error.
Try
Many well-designed programs that try code do not include any catch blocks; instead, they contain only _________.
Try-finally pairs
__________ statement are program statements that can never execute under any circumstances.
Unreachable code