C++ Institute C++ Certified Professional Programmer CPP Question # 6 Topic 1 Discussion

C++ Institute C++ Certified Professional Programmer CPP Question # 6 Topic 1 Discussion

CPP Exam Topic 1 Question 6 Discussion:
Question #: 6
Topic #: 1

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

#include

#include <algorithm>

#include

using namespace std;

int main () {

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

vector v (t,t+10);

vector::iterator it;

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

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

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

return 0;

}

Program outputs:


A.

found at position: 5


B.

found at position: 0


C.

found at position: 6


D.

found at position: 1


E.

found at position: 10


Get Premium CPP Questions

Contribute your Thoughts:


Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.