Services
Discover
Homeschooling
Ask a Question
Log in
Sign up
Filters
Done
Question type:
Essay
Multiple Choice
Short Answer
True False
Matching
Topic
Computing
Study Set
Big Java Binder Early Objects
Quiz 11: Inputoutput and Exception Handling
Path 4
Access For Free
Share
All types
Filters
Study Flashcards
Practice Exam
Learn
Question 1
Multiple Choice
Consider the following code snippet: PrintWriter out = new PrintWriter("output.txt") ; Which of the following statements about the PrintWriter object is correct?
Question 2
Multiple Choice
Which of the following statements about a PrintWriter object is true?
Question 3
Multiple Choice
Which of the following statements about using the PrintWriter object is correct?
Question 4
Multiple Choice
Consider the following code snippet: public static void main(String[] args) throws IOException Which of the following statements about this code is correct?
Question 5
Multiple Choice
Under which condition will the Scanner constructor generate a FileNotFoundException?
Question 6
Multiple Choice
Your program will read in an existing text file. You want the program to terminate if the file does not exist. Which of the following indicates the correct code for the main method header?
Question 7
Multiple Choice
Which of the following statements reflects the textbook's recommendations about closing files?
Question 8
Multiple Choice
Insert the missing code in the following code fragment. This fragment is intended to read an input file. public static void main(String[] args) throws FileNotFoundException { String inputFileName = "dataIn.txt"; String outputFileName = "dataOut.txt"; File inputFile = new File(inputFileName) ; Scanner in = _______________; ) . . }
Question 9
Multiple Choice
Which of the following is the correct syntax for creating a File object?
Question 10
Multiple Choice
Insert the missing code in the following code fragment. This fragment is intended to read a file and write to a file. public static void main(String[] args) throws FileNotFoundException { String inputFileName = "dataIn.txt"; String outputFileName = "dataOut.txt"; File inputFile = new File(inputFileName) ; Scanner in = new Scanner(inputFile) ; PrintWriter out = _____________; ) . . }
Question 11
Multiple Choice
Which of the following objects should be used for reading from a text file?
Question 12
Multiple Choice
Which of the following statements about reading and writing text files is correct?
Question 13
Multiple Choice
Insert the missing code in the following code fragment. This fragment is intended to read an input file named dataIn.txt and write to an output file named dataOut.txt. public static void main(String[] args) throws FileNotFoundException { String inputFileName = "dataIn.txt"; String outputFileName = "dataOut.txt"; File inputFile = _________________; Scanner in = new Scanner(inputFile) ) . . }
Question 14
Multiple Choice
Under which condition will the PrintWriter constructor generate a FileNotFoundException?
Question 15
Multiple Choice
Consider the following code snippet: public static void main(String[] args) throws FileNotFoundException Which of the following statements about this code is correct?
Question 16
Multiple Choice
The PrintWriter class is an enhancement of the ____ class.
Question 17
Multiple Choice
Insert the missing code in the following code fragment. This fragment is intended to read an input file. public static void main(String[] args) __________________ { String inputFileName = "dataIn.txt"; File inputFile = new File(inputFileName) ; Scanner in = new Scanner(inputFile) ; ) . . }
Question 18
Multiple Choice
Insert the missing code in the following code fragment. This fragment is intended to read an input file named dataIn.txt and write to an output file named dataOut.txt. public static void main(String[] args) throws FileNotFoundException { String inputFileName = "dataIn.txt"; String outputFileName = "dataOut.txt"; File inputFile = new File(inputFileName) ; Scanner in = _________; ) . . }
Question 19
Multiple Choice
Consider the following code snippet. File hoursFile = new File("hoursWorked.txt") ; Your program must read the contents of this file using a Scanner object. Which of the following is the correct syntax for doing this?