New Year Sale 2026! 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 1 Question 20 Discussion

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

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;

}

Show Suggested Answer Hide Answer
Suggested Answer: B

Contribute your Thoughts:

0/2000 characters
Ashton
4 months ago
Nah, it should just print the unique keys.
upvoted 0 times
...
Tarra
4 months ago
Wait, really? I thought it would show all the pairs!
upvoted 0 times
...
Bonita
4 months ago
I think it will output 1 2 3 4 5.
upvoted 0 times
...
Blythe
4 months ago
Totally agree, that’s not a valid method for multimaps.
upvoted 0 times
...
Tyisha
5 months ago
Looks like a compilation error due to push_back.
upvoted 0 times
...
Pamella
5 months ago
Okay, I think I've got this. The key is to use a virtual network with a single subnet and a standard Azure load balancer. That way, the VMs will be able to fail over quickly and maintain existing connections. Option B looks like the way to go here.
upvoted 0 times
...
Lashanda
5 months ago
Easy peasy! The question states the website is hosted on EC2 instances behind an Application Load Balancer, so the answer has to be B. We use an A record to point the zone apex to the IP address of the load balancer.
upvoted 0 times
...

Save Cancel