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

I need help with the following questions for C++: Question 1 In order to use the

ID: 3715840 • Letter: I

Question

I need help with the following questions for C++:


Question 1
In order to use the file handling functions in C++, you must include this header file:


Question 2
To read from a file, create an  object. To write to a file, create an object.

Question 3
What is it called when you open a file and read each piece of data in the file from start to finish?

sequential access

seeking

random access

Question 4
This function (or method) defined for ifstream or ofstream allows you to check to see if the file was opened successfully.


Question 5
Which statement is true about files?

a text file cannot be read by a human

a text file and a binary file are different names for the same thing

a binary file contains binary information and is machine readable

a binary file can be opened and read with software such as Notepad



Question 6
The term used in programming to indicate that there is no more data left in a file that is being read from sequentially is


Question 7
In any programming language, a flow of data between some device and your program is referred to as a

data flow

file

input flow

stream



Question 8

In this line of code, infile is a properly constructed file object and trainLoad is a variable holding data read from the file:

while (infile >> trainLoad)

What specific event will cause the expression to become false?

Explanation / Answer

Answers are highlighted in bold..

===============================================================


Question 1
In order to use the file handling functions in C++, you must include this header file:

Ans:

Yes, <fstream> header file is must to perform file handling operations.


Question 2
To read from a file, create an  object. To write to a file, create an object.

ifstream infile;           //infile is read file object

ofstream outfile;       //outfile is a write file object



Question 3
What is it called when you open a file and read each piece of data in the file from start to finish?

sequential access

seeking

random access

Question 4
This function (or method) defined for ifstream or ofstream allows you to check to see if the file was opened successfully.


filename.good()

Question 5
Which statement is true about files?

a text file cannot be read by a human

a text file and a binary file are different names for the same thing

a binary file contains binary information and is machine readable

a binary file can be opened and read with software such as Notepad



Question 6
The term used in programming to indicate that there is no more data left in a file that is being read from sequentially is

EOF             (End of file)


Question 7
In any programming language, a flow of data between some device and your program is referred to as a

data flow

file

input flow

stream



Question 8

In this line of code, infile is a properly constructed file object and trainLoad is a variable holding data read from the file:

while (infile >> trainLoad)

What specific event will cause the expression to become false?

If there is not data in the file.

===============================================================

KIndly Check and Verify Thanks..!!!