Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1. Which statement opens a file in such a way that information will only be writ

ID: 3687013 • Letter: 1

Question

1.   Which statement opens a file in such a way that information will only be written to its end?

a.

dataFile(open.append("info.dat"));

b.

dataFile.open("info.dat", ios::out | ios::app);

c.

dataFile.open = "C:\info.dat" ios:append;

d.

open(dataFile.append);

e.

None of these

2.   Closing a file causes any unsaved information still held in the file buffer to be

a.

saved to the file.

b.

deleted.

c.

retained in the buffer for safekeeping.

d.

duplicated.

e.

None of these

3.   The end-of-file marker is automatically written:

a.

when a file is opened with ios::eof

b.

when a file is opened with ios::app

c.

when a file is closed

d.

when the program ends

e.

None of these

a.

dataFile(open.append("info.dat"));

b.

dataFile.open("info.dat", ios::out | ios::app);

c.

dataFile.open = "C:\info.dat" ios:append;

d.

open(dataFile.append);

e.

None of these

Explanation / Answer

1. b) dataFile.open("info.dat", ios::out | ios::app);

2. a) saved to the file.

3 c) when a file is closed