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

Actual exam question for C++ Institute's CPP exam
Question #: 63
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,1,2,3,5,4};

vector v (t,t+10);

vector::iterator it;

int m1[] = {1, 3, 2};

it = find_end (v.begin(), v.end(), m1, m1+3);

if (it != v.end())

cout << "Found at position: " << it?v.begin() << endl;

return 0;

}

Show Suggested Answer Hide Answer
Suggested Answer: C

Contribute your Thoughts:

Alberta
4 days ago
Hmm, I think this code is trying to find the last occurrence of the sequence {1, 3, 2} in the vector 'v'. If it finds it, it should print the position. Let me think this through...
upvoted 0 times
...
Michael
7 days ago
I'm not sure, but I think the answer might be D.
upvoted 0 times
...
Shelton
10 days ago
I disagree, I believe the answer is B.
upvoted 0 times
...
Toshia
10 days ago
I think the answer is A.
upvoted 0 times
...

Save Cancel