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

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

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:

Show Suggested Answer Hide Answer
Suggested Answer: C

Contribute your Thoughts:

0/2000 characters
Hoa
4 months ago
I’m surprised it doesn’t just return 6 6.
upvoted 0 times
...
Kimberlie
4 months ago
Definitely going with option C, 6 7!
upvoted 0 times
...
Peggy
4 months ago
Wait, does it really insert duplicates?
upvoted 0 times
...
Jade
4 months ago
I think the output is 5 7.
upvoted 0 times
...
Lavina
5 months ago
The set will only contain unique values.
upvoted 0 times
...
Vernell
5 months 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.
upvoted 0 times
...
Carolann
5 months 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.
upvoted 0 times
...

Save Cancel