Big Java Binder Early Objects

Computing

Quiz 11 :

Inputoutput and Exception Handling

Quiz 11 :

Inputoutput and Exception Handling

Question Type
search
arrow
Consider the following code snippet: PrintWriter out = new PrintWriter("output.txt"); Which of the following statements about the PrintWriter object is correct?
Free
Multiple Choice
Answer:

Answer:

C

Tags
Choose question tag
close menu
arrow
Which of the following statements about a PrintWriter object is true?
Free
Multiple Choice
Answer:

Answer:

B

Tags
Choose question tag
close menu
arrow
Which of the following statements about using the PrintWriter object is correct?
Free
Multiple Choice
Answer:

Answer:

C

Tags
Choose question tag
close menu
arrow
Consider the following code snippet: public static void main(String[] args) throws IOException Which of the following statements about this code is correct?
Multiple Choice
Answer:
Tags
Choose question tag
close menu
arrow
Under which condition will the Scanner constructor generate a FileNotFoundException?
Multiple Choice
Answer:
Tags
Choose question tag
close menu
arrow
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?
Multiple Choice
Answer:
Tags
Choose question tag
close menu
arrow
Which of the following statements reflects the textbook's recommendations about closing files?
Multiple Choice
Answer:
Tags
Choose question tag
close menu
arrow
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 = _______________; ) . . }
Multiple Choice
Answer:
Tags
Choose question tag
close menu
arrow
Which of the following is the correct syntax for creating a File object?
Multiple Choice
Answer:
Tags
Choose question tag
close menu
arrow
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 = _____________; ) . . }
Multiple Choice
Answer:
Tags
Choose question tag
close menu
arrow
Which of the following objects should be used for reading from a text file?
Multiple Choice
Answer:
Tags
Choose question tag
close menu
arrow
Which of the following statements about reading and writing text files is correct?
Multiple Choice
Answer:
Tags
Choose question tag
close menu
arrow
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) ) . . }
Multiple Choice
Answer:
Tags
Choose question tag
close menu
arrow
Under which condition will the PrintWriter constructor generate a FileNotFoundException?
Multiple Choice
Answer:
Tags
Choose question tag
close menu
arrow
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
Answer:
Tags
Choose question tag
close menu
arrow
The PrintWriter class is an enhancement of the ____ class.
Multiple Choice
Answer:
Tags
Choose question tag
close menu
arrow
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); ) . . }
Multiple Choice
Answer:
Tags
Choose question tag
close menu
arrow
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 = _________; ) . . }
Multiple Choice
Answer:
Tags
Choose question tag
close menu
arrow
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?
Multiple Choice
Answer:
Tags
Choose question tag
close menu
arrow
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
Answer:
Tags
Choose question tag
close menu
Showing 1 - 20 of 109