Deal of The Day! Hurry Up, Grab the Special Discount - Save 25% - Ends In 00:00:00 Coupon code: SAVE25
Welcome to Pass4Success

- Free Preparation Discussions

C++ Institute Exam CPP Topic 4 Question 79 Discussion

Actual exam question for C++ Institute's CPP exam
Question #: 79
Topic #: 4
[All CPP Questions]

What will happen when you attempt to compile and run the code below, assuming that file test.out do not exist before the program execution?

#include

#include

#include

#include

#include

using namespace std;

templatestruct Out {

ostream & out;

Out(ostream & o): out(o){}

void operator() (const T & val ) {out<

int main (){

int t[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};

fstream f("test.out");

list l(t, t+10);

for_each(l.begin(), l.end(), Out(f));

f.close();

return 0;

}

Show Suggested Answer Hide Answer
Suggested Answer: C

Contribute your Thoughts:

Cristy
3 days ago
I'm not sure, but I think there might be a compilation error.
upvoted 0 times
...
Izetta
5 days ago
I believe the file test.out will contain the sequence 1 2 3 4 5 6 7 8 9 10.
upvoted 0 times
...
Casie
11 days ago
I think the file test.out will be created and opened for writing.
upvoted 0 times
...

Save Cancel