Exam 11: Exceptions, and Input Output Operations

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

An exception can only be thrown by a method that is not a constructor.

(True/False)
4.9/5
(33)

The PrintWriter class is designed for converting basic data types to characters and writing them to a text file.

(True/False)
4.8/5
(36)

The Java package that provides most classes for reading from and writing to files is java.io.

(True/False)
4.9/5
(33)

To read objects from a file, which class do we use?

(Multiple Choice)
4.8/5
(33)

What is the purpose of the following code segment? 13 String flightRecord1 = "AA123,BWI,SFO,235,239.5"; 14 Scanner parse = new Scanner( flightRecord1 ); 15 // set the delimiter to a comma 16 parse.useDelimiter( "," );

(Essay)
4.9/5
(37)

The purpose of the try and catch blocks is to:

(Multiple Choice)
4.8/5
(37)

When we open a file for appending and the file already exists:

(Multiple Choice)
4.8/5
(34)

To read from the file favoriteMovies, what information do you need?

(Multiple Choice)
4.9/5
(30)

Which method of the class Scanner do we use to set the delimiter when parsing a string?

(Multiple Choice)
4.9/5
(34)

Which of the following is the exception thrown by void writeObject( Object o )?

(Multiple Choice)
4.9/5
(34)

Replacing the contents of a file with new data is called appending the file.

(True/False)
4.8/5
(27)

Which of the following is the best constructor for reading objects from a file?

(Multiple Choice)
4.7/5
(36)

What is a delimiter?

(Multiple Choice)
4.9/5
(31)

We can use a lambda expression as an alternative to implementing a functional interface.

(True/False)
4.8/5
(37)

The class Scanner can be used to __________ a string.

(Short Answer)
4.8/5
(29)

What method of the Collection class can we use to convert an ArrayList to a Stream?

(Multiple Choice)
4.8/5
(40)

Suppose you write a program using the Scanner class to read data from a text file. The file is not found, but the code instantiating the Scanner was inside a try block. Predict what will happen, and explain why this is advantageous.

(Essay)
4.9/5
(32)

In which package is the class IOException?

(Multiple Choice)
4.9/5
(40)

The header of a method that potentially generates an exception when called contains the keyword:

(Multiple Choice)
4.9/5
(43)

Which package, introduced with Java 8, provides support for aggregate sequential and parallel operations on a collection of elements?

(Multiple Choice)
4.9/5
(38)
Showing 41 - 60 of 77
close modal

Filters

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