Filters
Question type

Study Flashcards

In order to use a variable both with a try or catch block and afterward, you must declare the variable before the ____ block begins.


A) catch
B) try
C) main
D) finally

E) A) and D)
F) C) and D)

Correct Answer

verifed

verified

Any ____________________ block might throw an Exception for which you did not provide a catch block.

Correct Answer

verifed

verified

When a program contains multiple ____ blocks, they are examined in sequence until a match is found for the type of exception that occurred.


A) throw
B) finally
C) catch
D) try

E) B) and D)
F) All of the above

Correct Answer

verifed

verified

Assertions are meant to be helpful in the ____ stage of a program.


A) development
B) testing
C) production
D) modeling

E) A) and B)
F) None of the above

Correct Answer

verifed

verified

The code within a finally block cannot execute if the preceding try block identifies an exception.

A) True
B) False

Correct Answer

verifed

verified

   Using the example code above, complete the statement of the catch block to generate the message that comes with the caught ArithmeticException . Using the example code above, complete the statement of the catch block to generate the message that comes with the caught ArithmeticException .

Correct Answer

verifed

verified

System.out...

View Answer

Placing data conversion attempts in a try block allows you to handle potential data conversion errors caused by careless user entry.

A) True
B) False

Correct Answer

verifed

verified

The ____ class represents more serious errors from which your program usually cannot recover.


A) Error
B) Throwable
C) Exception
D) Menu

E) C) and D)
F) B) and D)

Correct Answer

verifed

verified

Programs would be less clear if you had to account for ____ exceptions in every method declaration.


A) unthrown
B) thrown
C) runtime
D) checked

E) A) and D)
F) All of the above

Correct Answer

verifed

verified

A variable declared within a try or catch block is ____ to that block.


A) local
B) universal
C) public
D) unique

E) A) and C)
F) B) and C)

Correct Answer

verifed

verified

   The example code above uses the getMessage() method. Explain how the getMessage() method makes error message generation more specific to the error encountered. The example code above uses the getMessage() method. Explain how the getMessage() method makes error message generation more specific to the error encountered.

Correct Answer

verifed

verified

Although you can code an application to ...

View Answer

What things might a programmer do to cause a potential exception in a program?

Correct Answer

verifed

verified

The programs you write can generate many...

View Answer

When you have actions you must perform at the end of a try…catch sequence, you can use a ____ block.


A) finally
B) catch
C) throw
D) try

E) A) and D)
F) None of the above

Correct Answer

verifed

verified

If you create an object using Java's BigDecimal class, and then perform a division that results in a non-terminating decimal division such as 1/3, but specify that an exact result is needed, a(n) ____________________ is thrown.

Correct Answer

verifed

verified

Which method constructor constructs a new exception with the specified detail message and cause?


A) Exception()
B) Exception(String message)
C) Exception(String message, Throwable cause)
D) Exception(Throwable cause)

E) A) and D)
F) B) and C)

Correct Answer

verifed

verified

When you catch an Exception object, you can call ____________________ to display a list of methods in the call stack so you can determine the location of the statement that caused the exception.

Correct Answer

verifed

verified

When an exception is a checked exception, client programmers are forced to deal with the possibility that an exception will be thrown.

A) True
B) False

Correct Answer

verifed

verified

What is an Exception class? Give an example.

Correct Answer

verifed

verified

The Exception class comprises less serio...

View Answer

A(n) ____ is a Java language feature that can help you detect logic errors that do not cause a program to terminate, but nevertheless produce incorrect results.


A) error checker
B) thread
C) assertion
D) throw statement

E) C) and D)
F) A) and D)

Correct Answer

verifed

verified

To create your own throwable Exception class, you must extend a subclass of Catchable .

A) True
B) False

Correct Answer

verifed

verified

Showing 41 - 60 of 66

Related Exams

Show Answer