Exam 10: File IO

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

Binary files can be handled more efficiently than text files.

Free
(True/False)
4.7/5
(36)
Correct Answer:
Verified

True

Files whose contents must be handled as sequences of binary digits are called:

Free
(Multiple Choice)
5.0/5
(28)
Correct Answer:
Verified

C

Explain what happens when an output file is opened in Java.

Free
(Essay)
4.7/5
(44)
Correct Answer:
Verified

In Java,when an output stream is connected to a file,the program always starts with an empty file.If the file you are trying to connect to exists,the contents of the file are deleted before the output stream writes new data to the file.If the file you are trying to connect to does not exist,then a new empty file is created.

Write a Java statement to create an input stream to the binary file statistics.dat.

(Essay)
4.8/5
(31)

Write a Java statement to create an input stream to a file named "statistics.dat".

(Essay)
4.9/5
(42)

The methods of the scanner class do not behave the same when reading from a text file as they do when used to read from the keyboard.

(True/False)
4.9/5
(36)

The method __________ from the File class forces a physical write to the file of any data that is buffered.

(Multiple Choice)
4.7/5
(43)

Write a Java statement to create and open an output stream to a file named autos.txt.

(Essay)
4.8/5
(29)

The class ObjectInputStream contains all of the following methods except:

(Multiple Choice)
4.9/5
(35)

Using BufferedReader to read integers from a file requires the String input to be parsed to an integer type.

(True/False)
4.8/5
(47)

The class ObjectOutputStream contains all of the following methods except:

(Multiple Choice)
5.0/5
(41)

Write a Java statement that creates a stream that provides read/write access to the file named autos.txt.

(Essay)
4.8/5
(39)

Create try and catch block that opens a file named statistics.txt for output.Writes the integers 24,55,and 76 to the file,and then closes the file.

(Essay)
4.9/5
(44)

Every input file and every output file used by your program has only one name which is the same name used by the operating system.

(True/False)
4.8/5
(40)

A stream is an object that allows for the flow of data between your program and some I/O device or some file.

(True/False)
4.9/5
(33)

Only the classes provided for file output contain a method named close.

(True/False)
4.9/5
(36)

An ____________ allows data to flow from your program.

(Multiple Choice)
4.7/5
(32)

The stream that is automatically available to your Java code is:

(Multiple Choice)
4.9/5
(35)

When your program is finished writing to a file,it should close the stream connected to that file.

(True/False)
4.8/5
(41)

Write a complete Java program using a Scanner object that opens a file named autos.txt and displays each line to the screen.

(Essay)
4.7/5
(33)
Showing 1 - 20 of 46
close modal

Filters

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