adplus-dvertising
frame-decoration

Question

What is the output of this program in the “test.txt” file?
    #include <fstream>
    using namespace std;
    int main ()
    {
        long pos;
        ofstream outfile;
        outfile.open ("test.txt");
        outfile.write ("This is an apple",16);
        pos = outfile.tellp();
        outfile.seekp (pos - 7);
        outfile.write (" sam", 4);
        outfile.close();
        return 0;
    }

a.

This is an apple

b.

apple

c.

sample

d.

This is a sample

Answer: (d).This is a sample

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

Q. What is the output of this program in the “test.txt” file?