Exam 11: Exceptions and Advanced File IO
Exam 1: Introduction to Computers and Java51 Questions
Exam 2: Java Fundamentals61 Questions
Exam 3: Decision Structures64 Questions
Exam 4: Loops and Files57 Questions
Exam 5: Methods60 Questions
Exam 6: A First Look at Classes58 Questions
Exam 7: Arrays and the Arraylist Class64 Questions
Exam 8: A Second Look at Classes and Objects50 Questions
Exam 9: Text Processing and More About Wrapper Classes60 Questions
Exam 10: Inheritance70 Questions
Exam 11: Exceptions and Advanced File IO56 Questions
Exam 12: A First Look at GUI Applications60 Questions
Exam 13: Advanced GUI Applications58 Questions
Exam 14: Applets and More54 Questions
Exam 15: Creating GUI Applications With Javafx and Scene Builder40 Questions
Exam 16: Recursion42 Questions
Exam 17: Databases48 Questions
Select questions type
The ability to catch multiple types of exceptions with a single catch is known as ________, and was introduced in Java 7.
(Multiple Choice)
4.8/5
(37)
Beginning in Java 7, multi-catch can reduce a lot of duplicated code in a try statement that needs to catch multiple exceptions, but perform the same operation for each one.
(True/False)
4.8/5
(42)
The numeric classes' "parse" methods all throw an exception of this type if the string being converted does not contain a convertible numeric value.
(Multiple Choice)
4.9/5
(33)
If, within one try statement you want to have catch clauses of the following types, in which order should they appear in your program: (1) Exception
(2) IllegalArgumentException
(3) RuntimeException
(4) Throwable
(Multiple Choice)
4.7/5
(40)
If your code does not handle and exception when it is thrown, this prints an error message and crashes the program.
(Multiple Choice)
4.9/5
(36)
This is a section of code that gracefully responds to exceptions when they are thrown.
(Multiple Choice)
4.9/5
(35)
The throw statement informs the compiler that a method throws one or more exception.
(True/False)
4.9/5
(33)
In a try/catch construct, after the catch statement is executed:
(Multiple Choice)
4.8/5
(43)
A catch clause that uses a parameter variable of the Exception type is capable of catching any exception that extends the Error class.
(True/False)
4.7/5
(40)
When an object is serialized, it is converted into a series of bytes that contain the object's data.
(True/False)
4.8/5
(32)
If a random access file contains a stream of characters, which of the following would you use to set the pointer on the fifth character?
(Multiple Choice)
4.9/5
(40)
An exception's default error message can be retrieved using this method.
(Multiple Choice)
4.7/5
(33)
Under Windows, which of the following statements will open the file InputFile.txt that is in the root directory on the C: drive?
(Multiple Choice)
4.8/5
(36)
In a multi-catch, (introduced in Java 7) the exception types are separated in the catch clause by this symbol:
(Multiple Choice)
4.8/5
(31)
In the following code, assume that inputFile references a Scanner object that has been successfully used to open a file: double totalIncome = 0.0;
While (inputFile.hasNext())
{
Try
{
TotalIncome += inputFile.nextDouble();
}
Catch(InputMismatchException e)
{
System.out.println("Non-numeric data encountered " +
"in the file.");
InputFile.nextLine();
}
Finally
{
TotalIncome = 35.5;
}
}
What will be the value of totalIncome after the following values are read from the file?
2)5
8)5
3)0
5)5
Abc
1)0
(Multiple Choice)
4.8/5
(36)
Showing 41 - 56 of 56
Filters
- Essay(0)
- Multiple Choice(0)
- Short Answer(0)
- True False(0)
- Matching(0)