Exam 11: Inputoutput and Exception Handling

arrow
  • Select Tags
search iconSearch Question
flashcardsStudy Flashcards
  • Select Tags

Consider the following code snippet: Scanner in = new Scanner(. . .); While (in.hasNextInt()) { ) . . } Under which condition will the body of the while loop be processed?

(Multiple Choice)
4.8/5
(36)

Consider the following code snippet. PrintWriter outputFile = new PrintWriter("payrollReport.txt"); Which of the following statements about the PrintWriter object is correct?

(Multiple Choice)
4.8/5
(40)

When reading words using a Scanner object's next method, ____.

(Multiple Choice)
4.9/5
(35)

Select an expression to complete the program segment below, which is designed to read data from a file whose name is specified as the first command line argument. If no command line arguments are given, the program reads data from the default.txt file. String fileName = "default.txt"; If ( ________________________ ) { FileName = args[0]; } // additional statements to open file and read data

(Multiple Choice)
4.9/5
(41)

Which of the following statements about command line arguments is correct?

(Multiple Choice)
4.9/5
(33)

Consider the following code snippet: public void readFile(String filename) throws FileNotFoundException { File inFile = new File(filename); Scanner in = new Scanner(inFile); ) . . } If the file cannot be located, which of the following statements about this code is correct?

(Multiple Choice)
4.7/5
(40)

Select an expression to complete the following statement, which is designed to construct a PrintWriter object to write the program output to a file named dataout.txt PrintWriter theFile = _______________________;

(Multiple Choice)
4.7/5
(35)

Consider the following code snippet: PrintWriter out = new PrintWriter("output.txt"); Which of the following statements about the PrintWriter object is correct?

(Multiple Choice)
4.9/5
(41)

Consider the following code snippet: Scanner in = new Scanner(. . .); In)useDelimiter("[^0-9A-Za-z]+"); What characters will be ignored and not read in using this code?

(Multiple Choice)
4.8/5
(38)
Showing 101 - 109 of 109
close modal

Filters

  • Essay(0)
  • Multiple Choice(0)
  • Short Answer(0)
  • True False(0)
  • Matching(0)