Module 10 Quiz

अब Quizwiz के साथ अपने होमवर्क और परीक्षाओं को एस करें!

After the following program is finished, how many bytes are written to the file t.dat? import java.io.*; public class Test { public static void main(String[] args) throwsIOException { DataOutputStream output = new DataOutputStream(new FileOutputStream("t.dat")); output.writeChars("ABCD"); output.close(); } }

8 bytes

Which of the following statements are true? A) All files are stored in binary format. So, all files are essentially binary files. B) Text I/O is built upon binary I/O to provide a level of abstraction for character encoding and decoding. C) Encoding and decoding are automatically performed by text I/O. D) For binary input, you need to know exactly how data were written in order to read them in correct type and order.

A B C D

Which of the following is the legal mode for creating a new RandomAccessFile stream? A) "w" B) 'r' C) "rw" D) "rwx"

C

To create a file, you can use __________. A) FileOutputStream B) FileWriter C) RandomAccessFile D) All of these

D

True/False: A compilation error will occur if the file doesn't exist when creating a FileInputStream for the file.

False

What type of exception occurs when creating a DataInputStream for a nonexistent file?

FileNotFoundException

True/False: Closing an OutputStream ensures that the data in the buffer are sent to the destination.

True

True/False: RandomAccessFile, DataInputStream, and DataOutputStream share the same file formats.

True

True/False: The FileWriter, FileReader, FileInputStream, FileOutputStream, and RandomAccessFile classes can be used to process external files.

True

To append data to an existing file, use _______ to construct a FileOutputStream for file out.dat.

new FileOutputStream("out.data", true)


संबंधित स्टडी सेट्स

ECO/372T: Principles Of Macroeconomics - Week 2 Practice: Business Cycles, Unemployment, and Inflation

View Set

Chapter 19: Assessing Thorax and Lungs PrepU

View Set

AD1 HESI: Quality of Life, Perioperative, and Palliative Care

View Set