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

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 range;range = s1.equal_range(6);cout
C) 6 7
A) 6 6
B) 5 7
D) 1 5
E) 6 5

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