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 4 Question 21 Discussion

Posted by Ettie on May 07, 2022 at 02:16 AM

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

#include

#include

#include

using namespace std;

int main () {

int t[] = {1,2,3,4,5,1,2,3,4,5};

vector v (t,t+10);

vector::iterator it;

int m1[] = {1, 3, 2};

it = find_first_of (v.begin(), v.end(), m1, m1+3);

cout << "First found at position: " << it?v.begin() << endl;

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
PH
Phuong 11 months ago
The iterator returns the position, so A makes sense.
KR
Kristian 12 months ago
Wait, are you sure about that? Seems off to me.
BL
Blair 12 months ago
I thought it would be 0, but I guess not.
ME
Melinda 1 year ago
Definitely A, that's the correct output!
KA
Katlyn 1 year ago
It finds the first occurrence of 1, which is at index 5.
IS
Isadora 1 year ago
I feel pretty confident about this. The output should be S 5 based on the way the code is structured.
CH
Chantell 1 year ago
I'm leaning towards the Compliance policies tab. That's where we manage all the rules and restrictions for device access, including things like compromised status.
0/2000 characters

Save Cancel