In java language Question 1 In Java, what is an exception? Select one: a. a prim
ID: 3684851 • Letter: I
Question
In java language
Question 1
In Java, what is an exception?
Select one:
a. a primitive
b. a variable
c. an object
d. none of the above
Question 2
When an exception occurs it is said to have been ________.
Select one:
a. thrown
b. caught
c. handled
d. declared
Question 3
To catch an exception, the code that might throw the exception must be enclosed in a ________.
Select one:
a. finally block
b. throws block
c. catch block
d. try block
Question 4
Which of the following is included in an exception’s stack trace? Select all that apply.
Select one or more:
a. A descriptive message for the exception.
b. The method-call stack at the time the exception occurred.
c. Instructions on handling the exception.
d. The name of the exception.
Question 5
In the catch block below, what is ex?
catch (ArithmeticException ex) {
System.out.println(ex.getMessage());
}
Select one:
a. The name of catch block’s exception parameter.
b. The type of the exception being caught.
c. An exception handler.
d. A finally block.
Question 6
The throws clause of a method
Select one:
a. specifies the exceptions a method catches.
b. specifies the exceptions a method throws.
c. specifies the exceptions thrown by the calling method.
d. specifies the exceptions a method throws and catches.
Question 7
If an exception is thrown and is not caught anywhere in the program, then the program terminates.
Select one:
a. True
b. False
Question 8
A try statement must have at least one catch statement.
Select one:
a. True
b. False
Question 9
A try statement must have at least one finally statement.
Select one:
a. True
b. False
Question 10
A try statement can have more than one finally statement.
Select one:
a. True
b. False
Explanation / Answer
1. c. an object
2. a. thrown
3. d. try block
4. a. A descriptive message for the exception.
b. The method-call stack at the time the exception occurred.
d. The name of the exception.
5. a. The name of catch block’s exception parameter.
6. b. specifies the exceptions a method throws.
7. a. True
8. b. false (try and finally combination also fine)
9. b. false (try and catch combination is fine)
10. b. false
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.