C++ Institute C++ Certified Professional Programmer CPP Question # 4 Topic 1 Discussion

C++ Institute C++ Certified Professional Programmer CPP Question # 4 Topic 1 Discussion

CPP Exam Topic 1 Question 4 Discussion:
Question #: 4
Topic #: 1

Which sentence is correct about the code below? Choose all that apply.

#include

#include <algorithm>

#include

using namespace std;

class F {

int val;

public:

F(int v):val(v){}

bool operator() (int v) {

if (v == val) return true;

return false;

}

};

int main() {

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

vector v1(t, t + 10);

if (find(v1.begin(), v1.end(), 6) == find(v1.begin(), v1.end(), F(6))) {

cout<<"Found!\n";

} else {

cout<<"Not found!\n";

}

return 0;

}


A.

it will compile successfully


B.

it will display Found!


C.

it will display Not found!


D.

it will not compile successfully


Get Premium CPP Questions

Contribute your Thoughts:


Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.