• Wrong document? Swap it for free
  • Written by students who passed
  • Immediately available after payment
  • Read online or as PDF
Sell
Where do you study
Your language
Document preview thumbnail
Preview 2 out of 8 pages
Exam (elaborations)

C++ Chapter 12.

Document preview thumbnail
Preview 2 out of 8 pages

Exam of 8 pages for the course C++ Chapter 12 at C++ Chapter 12 (C++ Chapter 12)

Content preview

C++ Chapter 12 GRADE A QUESTIONS AND
ANSWERS
In order, the three-step process of using a file in a C++ program involves:



A) Insert a disk, open a file, remove the disk

B) Create the file contents, close the file, name the file

C) Open the file, read/write/save data, close the file

D) Name the file, open the file, delete the file - (correct answer)C



This data type can be used to create files and write information to them but cannot be
used to read information from them.

A) ofstream
B) ifstream

C) afstream

D) outstream - (correct answer)A



This data type can be used to create files, read data from them, and write data to them.

A) ofstream

B) iftream
C) fstream

D) stream - (correct answer)c



Which statement opens a file and links it to a file stream object?

A) open(aFile) = link(anObject);

B) file.open("c:\\filename.txt")

C) linkstream ("filename.txt");

D) link(open(filename.txt")); - (correct answer)B

, What is true about the following statement?

out.open("values.dat", ios::app);



A) If the file already exists, its contents are preserved and all output is written to the end
of the file

B) If the file exists, it should be replaced with a new copy of values.dat

C) If the file exists, it can be opened but not modified
D) None of these - (correct answer)A



Which of the following statements opens the file info.txt for both input and output?

A) dataFile.open("info.txt", ios::in && ios::out);

B) dataFile.open("info.txt", ios::in , ios::out);

C) dataFile.open("info.txt", input || output);

D) dataFile.open("info.txt", ios::in | ios::out); - (correct answer)D



The _________ marker is the character that marks the end of a file, and is automatically
written when the file is closed.

A) End of File (EOF)

B) No More Data (NMD)
C) Data Stream Close (DSC)

D) Data Read Stop (DRS) - (correct answer)A


This state bit can be tested to see if the end of an input stream is encountered.

A) ios::eof

B) ios::eofbit

C) ios::failbit
D) ios::badbit - (correct answer)B

Document information

Uploaded on
October 26, 2024
Number of pages
8
Written in
2024/2025
Type
Exam (elaborations)
Contains
Questions & answers
$11.99

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Seller avatar
douglasmugwe82
5.0
(1)
Sold
2
Followers
0
Items
4215
Last sold
1 year ago



Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions