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

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

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

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

#include

#include

using namespace std;

int main() {

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

string s[] = { "one", "one", "two", "two", "three","three", "four", "four", "five", "five"};

multimap m;

for (int i = 0; i < 10; i++) {

m.push_back(pair(t[i], s[i]));

}

for (multimap::iterator i = m.begin(); i != m.end(); i++) {

cout << i?>first << " ";

}

return 0;

}


A.

program outputs: 1 2 3 4 5


B.

compilation error


C.

program outputs: 1 1 2 2 3 3 4 4 5 5


D.

program outputs: one two three four five


E.

program outputs: one one two two three three four four five five


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.