How many bytes does the following code write to file dest?

1. try {
2. FileOutputStream fos = newFileOutputStream("dest");
3. DataOutputStream dos = new DataOutputStream(fos);
4. dos.writeInt(3);
5. dos.writeDouble(0.0001);
6. dos.close();
7. fos.close();
8. }
9. catch (IOException e) { }

A. 2
B. 8
C. 12
D. 16
E. The number of bytes depends on the underlying system.


Answer: C. 12

"C (The write Int() call writes out an int, which is 4 bytes long; the write Double() call writes out a double, which is 8 bytes long. The total is 12 bytes.)"

Computer Science & Information Technology

You might also like to view...

Clip art images can be resized by dragging a sizing handle

Indicate whether the statement is true or false

Computer Science & Information Technology

Data bars, color scales, and icon sets are examples of built-in conditional formatting options available in Excel 2011.

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

Computer Science & Information Technology

One method to gain additional information about an organization's mail server is to send an email that will bounce from the site

Indicate whether the statement is true or false.

Computer Science & Information Technology

What causes the most common problems with HTTPS?

A. PKI B. bad certificates C. revoked certificates D. bad URLs

Computer Science & Information Technology