Exam 12: Exception Handling

arrow
  • Select Tags
search iconSearch Question
flashcardsStudy Flashcards
  • Select Tags

What is the correct syntax of an assert statement?

(Multiple Choice)
4.7/5
(36)

  The example code above depicts a try block and a catch block. Describe how the try and catch blocks operate when illegal integer division is attempted. Describe what will happen if valid values are entered. The example code above depicts a try block and a catch block. Describe how the try and catch blocks operate when illegal integer division is attempted. Describe what will happen if valid values are entered.

(Essay)
4.9/5
(34)

An alternative to hard coding error messages into your Exception classes is creating a catalog of possible messages to use. What are the advantages of doing so?

(Essay)
4.9/5
(44)
Match each term with the correct statement below.
Premises:
Any process crucial to an organization
Responses:
mission critical.
Throwable
Exception(String message)
Correct Answer:
Verified
Premises:
Responses:
Any process crucial to an organization
mission critical.
(Matching)
5.0/5
(47)
Match each term with the correct statement below.
Premises:
List of methods called during program execution
Responses:
exception handling
mission critical
syntactic salt
Correct Answer:
Verified
Premises:
Responses:
List of methods called during program execution
exception handling
(Matching)
4.8/5
(44)

  In the above code, explain the importance of the shaded statement. What occurs if the statement is commented out of the program? In the above code, explain the importance of the shaded statement. What occurs if the statement is commented out of the program?

(Essay)
4.7/5
(37)
Match each term with the correct statement below.
Premises:
The parent class of Exception
Responses:
Exception(String message)
Exception(Throwable cause)
stack trace.
Correct Answer:
Verified
Premises:
Responses:
The parent class of Exception
Exception(String message)
(Matching)
5.0/5
(32)
Match each term with the correct statement below.
Premises:
Errors occurring during program exceution
Responses:
syntactic salt
assert statement
mission critical
Correct Answer:
Verified
Premises:
Responses:
Errors occurring during program exceution
syntactic salt
(Matching)
4.9/5
(33)

If you want to ensure that a user enters numeric data, you should use ____ techniques that provide the means for your program to recover from the mistake.

(Multiple Choice)
4.9/5
(35)
Match each term with the correct statement below.
Premises:
Indicates that a different method will catch the exception
Responses:
exception handling
Exception(Throwable cause)
mission critical
Correct Answer:
Verified
Premises:
Responses:
Indicates that a different method will catch the exception
exception handling
(Matching)
4.8/5
(36)

public static void main(String args[]) {    int a, b;    try    {       a = 0;       b = 42 / a;       System.out.println("This will not be printed.");    }   ​    catch (ArithmeticException e)    {       System.out.println("Division by zero.");    }    System.out.println("After catch statement."); } The program above includes a try block and a catch clause that processes the ArithmeticException generated by the division-by-zero error. Explain how the try and catch blocks operate, and what the output will be following program execution.

(Essay)
4.8/5
(43)

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

(Multiple Choice)
4.8/5
(37)

____ exceptions are the type that programmers should anticipate and from which programs should be able to recover.

(Multiple Choice)
4.9/5
(40)

Unplanned exceptions that occur during a program's execution are also called execution exceptions.

(True/False)
4.9/5
(36)

Some programmers refer to a catch block as a catch ____.

(Multiple Choice)
5.0/5
(47)

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

(Multiple Choice)
4.7/5
(32)

A(n) ____ statement is one that sends an Exception object to a catch block.

(Multiple Choice)
4.9/5
(34)
Match each term with the correct statement below.
Premises:
Constructs a new exception with the specified detail message
Responses:
throws clause.
syntactic salt
mission critical.
Correct Answer:
Verified
Premises:
Responses:
Constructs a new exception with the specified detail message
throws clause.
(Matching)
4.8/5
(38)

What is a finally block and how would a programmer use it?

(Essay)
4.9/5
(26)

How is an Error class different from an Exception class?

(Essay)
4.9/5
(39)
Showing 21 - 40 of 79
close modal

Filters

  • Essay(0)
  • Multiple Choice(0)
  • Short Answer(0)
  • True False(0)
  • Matching(0)