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 74 Discussion

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

What happens when you attempt to compile and run the following code?

#include

#include

#include

using namespace std;

int main ()

{

int t[] = {1, 2 ,3 ,4 ,5};

vectorv1(t, t+5);

listl1;

l1.assign(v1.end(), v1.begin());

for(int i=0; i

{

cout<

}

cout<

return 0;

}

Show Suggested Answer Hide Answer
Suggested Answer: E

Contribute your Thoughts:

Maryrose
2 days ago
I'm not sure, but I think the correct answer is A.
upvoted 0 times
...
Kenny
4 days ago
Hmm, the `assign()` function in line 9 looks a bit strange. I'm not sure if that's gonna work as expected. I'll go with C) compilation error in line 8.
upvoted 0 times
...
Corazon
4 days ago
The code seems to be working correctly, so I think the answer is B) program outputs 1 2 3 4 5.
upvoted 0 times
...
Colby
7 days ago
I believe there might be a compilation error in line 8.
upvoted 0 times
...
Maryrose
12 days ago
I think the program will output 5 4 3 2 1.
upvoted 0 times
...

Save Cancel