Exam 11: Input/Output and Exception Handling

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

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

(Multiple Choice)
4.8/5
(26)

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. 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.

(Multiple Choice)
4.9/5
(33)

Which of the following is the correct syntax for starting a Java program named myProg from a command line if the program requires two arguments named arg1 and arg2 to be supplied?

(Multiple Choice)
4.8/5
(35)

Which of the following statements about using the PrintWriter object is correct?

(Multiple Choice)
4.8/5
(32)

Assume inputFile is a Scanner object used to read data from a text file that contains a number of lines.Some lines contain an alphabetic string, while others contain a single integer value.Select an expression to complete the following code segment, which counts the number of integer values in the input file. Assume inputFile is a Scanner object used to read data from a text file that contains a number of lines.Some lines contain an alphabetic string, while others contain a single integer value.Select an expression to complete the following code segment, which counts the number of integer values in the input file.

(Multiple Choice)
4.8/5
(42)

Insert the missing code in the following code fragment.This fragment is intended to read an input file named dataIn.txt. Insert the missing code in the following code fragment.This fragment is intended to read an input file named dataIn.txt.

(Multiple Choice)
4.8/5
(30)

Insert the missing code in the following code fragment.This fragment is intended to write an output file named dataOut.txt that resides in a folder named reports on the C: drive of a Windows system. Insert the missing code in the following code fragment.This fragment is intended to write an output file named dataOut.txt that resides in a folder named reports on the C: drive of a Windows system.

(Multiple Choice)
4.7/5
(37)

When you start a Java program from a command line and supply argument values, the values ____.

(Multiple Choice)
4.9/5
(37)

Consider the following code snippet: Consider the following code snippet:   If the input file contains the characters 626.14 average, what values will number and result have after this code is executed? If the input file contains the characters 626.14 average, what values will number and result have after this code is executed?

(Multiple Choice)
4.7/5
(34)

Consider the following code snippet: Consider the following code snippet:   If the file cannot be located, which of the following statements about this code is correct? If the file cannot be located, which of the following statements about this code is correct?

(Multiple Choice)
4.9/5
(32)

You wish to use the Scanner class's nextInt() method to read in whole numbers.To avoid exceptions that would occur if the input is not a whole number, you should use the ____ method before calling nextInt().

(Multiple Choice)
4.7/5
(34)

Consider the following code snippet: Consider the following code snippet:   If the input file begins with the characters 626.14 average, what values will number and result have after this code is executed? If the input file begins with the characters 626.14 average, what values will number and result have after this code is executed?

(Multiple Choice)
4.8/5
(40)

Which expression converts the string input containing floating-point digits to its floating-point value?

(Multiple Choice)
4.8/5
(43)

Which of the following statements about exception reporting is true?

(Multiple Choice)
5.0/5
(47)

If the current method in a program will not be able to handle an exception, what should be coded into the method?

(Multiple Choice)
4.7/5
(46)

Which statement about handling exceptions is true?

(Multiple Choice)
4.8/5
(29)

Consider the following code snippet: throw new IllegalArgumentException("This operation is not allowed!"); Which of the following statements about this code is correct?

(Multiple Choice)
4.8/5
(33)

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

(Multiple Choice)
4.9/5
(43)

Which of the following statements about reading web pages is true?

(Multiple Choice)
4.9/5
(38)

Which of the following statements about reading and writing text files is correct?

(Multiple Choice)
4.9/5
(45)
Showing 41 - 60 of 108
close modal

Filters

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