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 1 Question 20 Discussion

Posted by Jesusita on May 03, 2022 at 10:13 AM

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;

}

Suggested Answer: B

Get Premium CPP Questions as Interactive Web-Based Practice Test or PDF Real Exam Format Detailed Explanations Instant Access Get Your Practice Test
7 comments · newest first
AS
Ashton 11 months ago
Nah, it should just print the unique keys.
TA
Tarra 12 months ago
Wait, really? I thought it would show all the pairs!
BO
Bonita 12 months ago
I think it will output 1 2 3 4 5.
BL
Blythe 1 year ago
Totally agree, that’s not a valid method for multimaps.
TY
Tyisha 1 year ago
Looks like a compilation error due to push_back.
PA
Pamella 1 year 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.
LA
Lashanda 1 year 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.
0/2000 characters

Save Cancel