C++ Institute C++ Certified Professional Programmer CPP Question # 37 Topic 4 Discussion

C++ Institute C++ Certified Professional Programmer CPP Question # 37 Topic 4 Discussion

CPP Exam Topic 4 Question 37 Discussion:
Question #: 37
Topic #: 4

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

#include

#include

#include

using namespace std;

int main(){

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

string first[] = {"three", "four", "two", "one", "six","five", "seven", "nine","eight"," ten"};

multimap m;

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

m.insert(pair(second[i],first[i]));

}

if (m[11] == "eleven") {

cout<<"eleven ";

}

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

cout<second<<" ";

}

cout<

return 0;

}


A.

program outputs: one two three four five six seven eight nine ten 11


B.

program outputs: one two three four five six seven eight nine ten 10


C.

program outputs: one two three four five six seven eight nine ten 10


D.

program outputs: eleven one two three four five six seven eight nine ten 10


E.

compilation error


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.