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 5 Question 3 Discussion

Posted by Kirk on May 06, 2022 at 02:58 AM

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

#include

#include

#include

using namespace std;

int main(){

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

vectorv(t, t+10);

set s1(v.begin(),v.end());

s1.insert(v.begin(),v.end());

pair::iterator,set::iterator> range;

range = s1.equal_range(6);

cout<<*range.first<<" "<<*range.second<

return 0;

}

The output will be:

Suggested Answer: C

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
HO
Hoa 11 months ago
I’m surprised it doesn’t just return 6 6.
KI
Kimberlie 12 months ago
Definitely going with option C, 6 7!
PE
Peggy 12 months ago
Wait, does it really insert duplicates?
JA
Jade 12 months ago
I think the output is 5 7.
LA
Lavina 1 year ago
The set will only contain unique values.
VE
Vernell 1 year ago
Defers data access rules for business users? That doesn't sound like it would be part of a privacy incident plan. I'll go with that one.
CA
Carolann 1 year ago
I'm a little confused by this question. I know ES has adaptive actions, but I can't remember the specifics of what they are or which one is the default. I'll have to review my notes before answering this.
0/2000 characters

Save Cancel