SDEV200 -- Ch17
Which of the following is the legal mode for creating a new RandomAccessFile stream?
"rw"
Which of the following statements are true?
-All files are stored in binary format. So, all files are essentially binary files. -Text I/O is built upon binary I/O to provide a level of abstraction for character encoding and decoding. -Encoding and decoding are automatically performed by text I/O. -For binary input, you need to know exactly how data were written in order to read them in correct type and order.
To create a file, you can use ________.
-FileOutputStream -FileWriter -RandomAccessFile
After the following program is finished, how many bytes are written to the file t.dat? public class Test { public static void main(String[] args) throwsIOException { Data OutputStream output = new DataOutputStream ( new FileOutputStream("t.dat")); output.writeChars("ABCD"); output.close(); } }
8 bytes
Which type of exception occurs when creating a DataInputStream for a nonexistent file?
FileNotFoundException
A compilation error will occur if the file doesn't exist when creating a FileInputStream for the file.
false
To append data to an existing file, use ________ to construct a FileOutputStream for file out.dat.
new FileOutputStream("out.dat", true)
Closing an OutputStream ensures that the data in the buffer are sent to the destination.
true
RandomAccessFile, DataInputStream, and DataOutputStream share the same file formats.
true
The FileWriter, FileReader, FileInputStream, FileOutputStream, and RandomAccessFile classes can be used to process external files.
true