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
What is demonstrated by the following code?
Try
{
(try block statements . . .)
}
Catch(NumberFormatException | IOException ex)
{
RespondToError();
}
(Multiple Choice)
4.9/5
(40)
If you want to append data to the existing binary file, BinaryFile.dat, use the following statements to open the file.
(Multiple Choice)
4.8/5
(31)
If the IOData.dat file does not exist, what will happen when the following statement is executed?
RandomAccessFile randomFile =
New RandomAccessFile("IOData.dat", "rw");
(Multiple Choice)
4.7/5
(48)
The call stack is an internal list of all the methods that are currently executing.
(True/False)
4.9/5
(39)
A(n) ________ is an object that is generated in memory as the result of an error or an unexpected event.
(Multiple Choice)
4.7/5
(41)
When writing a string to a binary file or reading a string from a binary file, it is recommended that you use:
(Multiple Choice)
4.8/5
(40)
When deserializing an object using the readObject method, you must cast the return value to the desired class type.
(True/False)
4.8/5
(41)
In versions of Java prior to Java 7, each catch clause can handle only one type of exception.
(True/False)
4.7/5
(46)
When the code in a try block may throw more than one type of exception, you need to write a catch clause for each type of exception that could potentially be thrown.
(True/False)
4.9/5
(32)
If a method does not handle a possible checked exception, what must the method have?
(Multiple Choice)
4.9/5
(43)
To write data to a binary file you create objects from the following classes:
(Multiple Choice)
5.0/5
(30)
The IllegalArgumentException class extends the RuntimeException class, and is therefore:
(Multiple Choice)
4.8/5
(34)
When an exception is thrown by a method that is executing under several layers of method calls, a stack trace indicates the method executing when an exception occurred and all of the methods that were called in order to execute that method.
(True/False)
4.8/5
(37)
Look at the following code: FileInputStream fstream =
New FileInputStream("MyInfo.dat");
DataInputStream inputFile =
New DataInputStream(fstream);
This code can also be written as:
(Multiple Choice)
4.8/5
(42)
Assume that the classes BlankISBN, NegativePrice, and NegativeNumberOrdered are exception classes that inherit from Exception. The following code is a constructor for the Book class. What must be TRUE about any method that instantiates the Book class with this constructor?
Public Book(String ISBNOfBook, double priceOfBook,
Int numberOrderedOfBook) throws BlankISBN,
NegativePrice,
NegativeNumberOrdered
{
If (ISBNOfBook == "")
Throw new BlankISBN();
If (priceOfBook < 0)
Throw new NegativePrice(priceOfBook);
If (numberedOrderedOfBook < 0)
Throw new NegativeNumberOrdered(numberOrderedv);
ISBN = ISBNOfBook;
Price = priceOfBook;
NumberedOrdered = numberOrderedOfBook;
}
(Multiple Choice)
4.8/5
(41)
If the code in a method can potentially throw a checked exception, then that method must:
(Multiple Choice)
4.9/5
(39)
When you write a method that throws a checked exception, you must:
(Multiple Choice)
4.8/5
(41)
Showing 21 - 40 of 56
Filters
- Essay(0)
- Multiple Choice(0)
- Short Answer(0)
- True False(0)
- Matching(0)