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 CPP Exam - Topic 9 Question 23 Discussion

What will be output of the program when you attempt to compile and run the following code?#include #include #include #include using namespace std;int main(){int second[] ={ 3, 4, 2, 1, 6, 5, 7, 9, 8, 0 };string first[] = {"three", "four", "two", "one", "six","five", "seven", "nine","eight","zero"};multimap m;for(int i=0; i
E) compilation error
A) zero one two three four five six seven eight nine
B) ten one two three four five six seven eight nine
C) zero eleven two three four five six seven eight nine
D) ten eleven two three four five six seven eight nine

C++ Institute CPP Exam - Topic 9 Question 23 Discussion

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

What will be output of the program when you attempt to compile and run the following code?

#include

#include

#include

#include

using namespace std;

int main(){

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

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

multimap m;

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

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

}

m[0]="ten";

m.insert(pair(1,"eleven"));

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

cout<second<<" ";

}

return 0;

}

Show Suggested Answer Hide Answer
Suggested Answer: E

Contribute your Thoughts:

0/2000 characters
Marleen
7 months ago
I'm pretty sure it's option C, but I'm not 100% convinced!
upvoted 0 times
...
Lenora
7 months ago
Wait, can you really assign like that in a multimap?
upvoted 0 times
...
Anna
7 months ago
I think the output will be "ten eleven two three four five six seven eight nine".
upvoted 0 times
...
Harris
8 months ago
Definitely not a compilation error, it's valid C++.
upvoted 0 times
...
Tawanna
8 months ago
Looks like a compilation error due to m[0] assignment!
upvoted 0 times
...
Gilbert
8 months ago
I remember learning about the MID Server in class, and I believe it uses port 445 for outbound connections. That's my best guess for this question.
upvoted 0 times
...

Save Cancel