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) throws IOException {
DataOutputStream output = new DataOutputStream(
new FileOutputStream("t.dat"));
output.writeUTFString("ABCD");
output.close();
}
}```
a. 2 bytes.
b. 4 bytes.
c. 6 bytes.
d. 8 bytes.
e. 10 bytes.


c "ABCD" are ASCII code, so each takes one byte in UTF. Total is 6 because the first two bytes stores the number of characters in the string.

Computer Science & Information Technology

You might also like to view...

The Windows Task Manager helps you troubleshoot application problems. 

Answer the following statement true (T) or false (F)

Computer Science & Information Technology

Which of the following statements are true?

``` Segment 1 Segment 2 int i = 0; for (int i = 0; i <= 20; i++) { while (i < 20) { System.out.println(i); i++; } System.out.println(i); } ``` a. The output from these segments is not the same. b. The scope of the control variable i is different for the two segments. c. Both (a) and (b) are true. d. Neither (a) nor (b) is true.

Computer Science & Information Technology

A method's ____________ is not part of the signature.

a. return type b. name c. parameter data type d. argument kind

Computer Science & Information Technology

Use the ____ method of the Document object before using the write() method.

A. open() B. close() C. writeln() D. URL()

Computer Science & Information Technology