Exam 11: Exceptions, and Input Output Operations

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

When is it good practice to call the close method?

(Multiple Choice)
4.8/5
(28)

It is legal to have more than one catch block to match a try block.

(True/False)
4.9/5
(30)

Tokens separate one delimiter from the next.

(True/False)
4.7/5
(40)

Assuming numberStream is a Stream containing doubles, the following code is adding all the doubles in the Stream that are greater than 5.0. double sum = numberStream.mapToDouble( item -> Double.parseDouble( item ) ) .filter( price -> price > 5.0 ) .sum( );

(True/False)
4.9/5
(38)

Tyler wrote a code that includes multiple catch blocks to catch files not found and characters that are not integers. Predict what will happen if a user enters an invalid file and also enters a 1.5 for the integer.

(Essay)
4.9/5
(32)

When reading objects from a file, until we have reached the end of the file, the condition for the while loop inside a try block is:

(Multiple Choice)
4.9/5
(44)

For an object of a class to be written to a file, that class must implement the __________ interface.

(Short Answer)
4.8/5
(43)

How can the methods of the Exception class be useful?

(Essay)
4.9/5
(40)

Code that could generate a checked exception must be coded with a try and catch block or placed inside a method that throws that exception itself.

(True/False)
4.9/5
(34)

To handle an exception, we use a _________ construct.

(Multiple Choice)
4.8/5
(42)

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

(Multiple Choice)
4.7/5
(39)

The return value for all Scanner methods is boolean.

(True/False)
4.7/5
(31)

Your program will work as long as it does not generate compiler errors.

(True/False)
4.7/5
(39)

A Stream can easily be constructed from an ArrayList.

(True/False)
4.9/5
(36)

The __________ class encapsulates the concept of a Uniform Resource Locator.

(Short Answer)
4.7/5
(38)

Professor Simmons had a text file of students in his first-year economics class last semester. This semester, he has all new students. What action should he take to create a useful file for this semester?

(Multiple Choice)
4.8/5
(30)

Sydney accidentally entered .5 instead of 5 in a code asking that she input an integer. She did not get a compiler error, but the program did not run because it generated an exception, which terminated the program.

(True/False)
4.9/5
(33)

Which classes can we use to create a Stream from a file in a single statement?

(Multiple Choice)
4.8/5
(38)

When we open a file for appending and the file does not exist, what will happen?

(Multiple Choice)
4.9/5
(44)

ObjectOutputStream( OutputStream out ) is a:

(Multiple Choice)
4.9/5
(37)
Showing 21 - 40 of 77
close modal

Filters

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