Exam 11: Inputoutput and Exception Handling
Exam 1: Introduction98 Questions
Exam 2: Using Objects76 Questions
Exam 3: Implementing Classes103 Questions
Exam 4: Fundamental Data Types125 Questions
Exam 5: Decisions120 Questions
Exam 6: Loops128 Questions
Exam 7: Arrays and Array Lists118 Questions
Exam 8: Designing Classes95 Questions
Exam 9: Inheritance101 Questions
Exam 10: Interfaces85 Questions
Exam 11: Inputoutput and Exception Handling109 Questions
Exam 12: Object-Oriented Design104 Questions
Exam 13: Recursion110 Questions
Exam 14: Sorting and Searching109 Questions
Exam 15: The Java Collections Framework110 Questions
Exam 16: Basic Data Structures104 Questions
Exam 17: Tree Structures110 Questions
Exam 18: Generic Classes75 Questions
Exam 19: Graphical User Interfaces76 Questions
Exam 20: Streams and Binary Inputoutput82 Questions
Exam 21: Multithreading82 Questions
Exam 22: Internet Networking74 Questions
Exam 23: Relational Databases75 Questions
Exam 24: XML74 Questions
Exam 25: Web Applications75 Questions
Select questions type
Consider the following code snippet: PrintWriter outputFile = new PrintWriter(filename);
WriteData(outputFile);
OutputFile.close();
How can the program ensure that the file will be closed if an exception occurs on the writeData call?
(Multiple Choice)
4.9/5
(38)
Which of the following statements about the finally clause in a try block is NOT true?
(Multiple Choice)
4.9/5
(34)
Consider the following code snippet: File inputFile = new File("input.txt");
You wish to read the contents of this file using a Scanner object. Which of the following is the correct syntax for doing this?
(Multiple Choice)
4.8/5
(38)
Which of the following statements about checked and unchecked exceptions is NOT true?
(Multiple Choice)
4.8/5
(45)
Which of the following statements about reading web pages is true?
(Multiple Choice)
4.7/5
(37)
Consider the following code snippet. Scanner inputFile = new Scanner("hoursWorked.txt");
Which of the following statements is correct?
(Multiple Choice)
4.7/5
(35)
The Java compiler requires that your program handle which type of exceptions?
(Multiple Choice)
4.8/5
(36)
Insert the missing code in the following code fragment. This fragment is intended to read an input file named dataIn.txt that resides in a folder named payroll on the C: drive of a Windows system. public static void main(String[] args) throws FileNotFoundException
{
File inputFile = ________;
Scanner in = new Scanner(inputFile);
) . .
}
(Multiple Choice)
4.9/5
(39)
Which of the following statements about reading and writing binary data is correct?
(Multiple Choice)
4.8/5
(47)
When reading words with a Scanner object, a word is defined as ____.
(Multiple Choice)
4.9/5
(39)
Under which condition will the Scanner constructor generate a FileNotFoundException?
(Multiple Choice)
4.8/5
(38)
Consider the following code snippet: Scanner in = new Scanner(. . .);
While (in.hasNextLine())
{
String input = in.nextLine();
System.out.println(input);
}
Which of the following statements about this code is correct?
(Multiple Choice)
4.8/5
(40)
Which of the following statements reflects the textbook's recommendations about closing files?
(Multiple Choice)
4.8/5
(39)
An example of a fatal error that rarely occurs and is beyond your control is the ____.
(Multiple Choice)
4.8/5
(43)
Which of the following is the correct syntax for creating a File object?
(Multiple Choice)
4.8/5
(34)
Consider the following code snippet: public static void main(String[] args) throws FileNotFoundException
Which of the following statements about this code is correct?
(Multiple Choice)
4.8/5
(52)
Insert the missing code in the following code fragment. This fragment is intended to read all words from a text file. File inputFile = new File("dataIn.txt");
Scanner in = new Scanner(dataIn.txt);
While (____________)
{
String input = in.next();
System.out.println(input);
}
(Multiple Choice)
4.9/5
(33)
When you start a Java program from a command line and supply argument values, the values ____.
(Multiple Choice)
5.0/5
(42)
When a program throws an exception within a method that has no try-catch block, which of the following statements about exception handling is true?
(Multiple Choice)
4.9/5
(34)
Showing 81 - 100 of 109
Filters
- Essay(0)
- Multiple Choice(0)
- Short Answer(0)
- True False(0)
- Matching(0)