Exam 11: Input/Output and Exception Handling

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

Insert the missing code in the following code fragment.This fragment is intended to allow the user to select a file to be opened. Insert the missing code in the following code fragment.This fragment is intended to allow the user to select a file to be opened.

Free
(Multiple Choice)
4.9/5
(39)
Correct Answer:
Verified

C

Select an appropriate expression to complete the header for the method below. Select an appropriate expression to complete the header for the method below.

Free
(Multiple Choice)
4.8/5
(40)
Correct Answer:
Verified

D

The ______ method of the Scanner class specifies a pattern for word boundaries when reading text.

Free
(Multiple Choice)
4.8/5
(26)
Correct Answer:
Verified

C

Which command enables assertion checking during program execution?

(Multiple Choice)
4.9/5
(40)

Which of the following statements about character encodings is NOT true?

(Multiple Choice)
4.9/5
(34)

Insert the missing code in the following code fragment.This code is intended to open a file and handle the situation where the file cannot be found. Insert the missing code in the following code fragment.This code is intended to open a file and handle the situation where the file cannot be found.

(Multiple Choice)
4.8/5
(37)

Consider the following code snippet: Consider the following code snippet:   What characters will be read in using this code? What characters will be read in using this code?

(Multiple Choice)
4.8/5
(26)

Which method of an exception object will retrieve a description of the exception that occurred?

(Multiple Choice)
4.8/5
(39)

Which of the following statements about exception handling is correct?

(Multiple Choice)
4.7/5
(38)

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)

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)
4.9/5
(40)

Consider the following code snippet, assuming that filename represents the name of the output file and writeData outputs the data to that file: Consider the following code snippet, assuming that filename represents the name of the output file and writeData outputs the data to that file:   Which of the following statements about this code is correct? Which of the following statements about this code is correct?

(Multiple Choice)
4.8/5
(44)

Consider the following code snippet, where data is a variable defined as a double array that is populated by the readData method for valid data: Consider the following code snippet, where data is a variable defined as a double array that is populated by the readData method for valid data:   Which of the following statements about this method's code is correct? Which of the following statements about this method's code is correct?

(Multiple Choice)
4.9/5
(45)

Consider the following code snippet: Consider the following code snippet:   Which of the following statements about this code is correct? Which of the following statements about this code is correct?

(Multiple Choice)
4.9/5
(37)

Which of the following statements about checked and unchecked exceptions is NOT true?

(Multiple Choice)
4.8/5
(38)

Complete the code fragment below, which is designed to throw an exception if String variable accountNumber has more than seven characters. Complete the code fragment below, which is designed to throw an exception if String variable accountNumber has more than seven characters.

(Multiple Choice)
4.7/5
(39)

Assume inputFile is a Scanner object used to read data from a text file that contains a number of lines.Each line contains an arbitrary number of words, with at least one word per line.Select an expression to complete the following code segment, which prints the last word in each line. Assume inputFile is a Scanner object used to read data from a text file that contains a number of lines.Each line contains an arbitrary number of words, with at least one word per line.Select an expression to complete the following code segment, which prints the last word in each line.

(Multiple Choice)
4.9/5
(44)

Insert the missing code in the following code fragment.This fragment is intended to read characters from a text file. Insert the missing code in the following code fragment.This fragment is intended to read characters from a text file.

(Multiple Choice)
4.9/5
(43)

Which String class method will remove spaces from the beginning and the end of a string?

(Multiple Choice)
4.7/5
(47)

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)
4.8/5
(34)
Showing 1 - 20 of 108
close modal

Filters

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