Summer Certification Limited Time 70% Discount Offer - Ends in 0d 00h 00m 00s - Coupon code = getmirror

Pass the C++ Institute C++ Certified Professional Programmer CPP Questions and answers with ExamsMirror

Practice at least 50% of the questions to maximize your chances of passing.
Exam CPP Premium Access

View all detail and faqs for the CPP exam


694 Students Passed

86% Average Score

95% Same Questions
Viewing page 7 out of 7 pages
Viewing questions 61-70 out of questions
Questions # 61:

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

#include

#include

#include <algorithm>

#include

using namespace std;

class B { int val;

public:

B(int v=0):val(v){}

int getV() const {return val;}

operator int () const { return val;} };

templatestruct Out {

ostream & out;

Out(ostream & o): out(o){}

void operator() (const T & val ) { out<

int main() {

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

vector v1(t, t+10);

for_each(v1.begin(), v1.end(), bind1st(plus(), 1));

for_each(v1.rbegin(), v1.rend(), Out(cout));cout<

return 0;

}

Program outputs:

Options:

A.

3 2 4 1 5 6 10 8 7 9

B.

4 3 5 2 6 7 11 9 8 10

C.

9 7 8 10 6 5 1 4 2 3

D.

10 8 9 11 7 6 2 5 3 4

E.

compilation error

Questions # 62:

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

#include

#include <algorithm>

#include

using namespace std;

int main () {

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

vector v (t,t+15);

vector::iterator it = search_n(v.begin(), v.end(), 4, 2);

cout<< it?v.begin()<

return 0;

}

Program outputs:

Options:

A.

10

B.

3

C.

1

D.

15

E.

compilation error

Questions # 63:

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

#include

#include <algorithm>

#include

using namespace std;

int main () {

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

vector v (t,t+15);

int number = count(v.begin(), v.end(), 2);

cout<< number<

return 0;

}

Program outputs:

Options:

A.

4

B.

3

C.

2

D.

0

E.

compilation error

Questions # 65:

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

include

#include <algorithm>

#include

#include

#include

using namespace std;

int main() {

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

vector v1(t, t + 10);

deque d1(t, t + 10);

set s1(t, t + 10);

cout<

return 0;

}

Options:

A.

program outputs: 6 6 6

B.

program outputs: 3 3 5

C.

program outputs: 3 6 5

D.

compilation error

E.

none of these

Questions # 66:

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

#include

#include

#include

#include <algorithm>

using namespace std;

void print(int v) { cout<

struct Sequence {

int start;

Sequence(int start):start(start){}

int operator()() { return start++; }

};

bool predicate(int v) { return v%2==0; }

int main() {

vector v1(10);

generate_n(v1.begin(), 10, Sequence(1));

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

remove_if(s1.begin(), s1.end(), predicate);

for_each(s1.begin(), s1.end(), print);cout<

return 0;

}

Program outputs:

Options:

A.

1 3 5 7 9 6 7 8 9 10

B.

1 3 5 7 9

C.

2 4 6 8 10

D.

compilation error

Questions # 67:

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

#include

#include

#include <algorithm>

#include

using namespace std;

templatestruct Out {

ostream & out;

Out(ostream & o): out(o){}

void operator() (const T & val ) { out<

int Add(int a, int b) {

return a+b;

}

int main() {

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

vector v1(t, t+10);

vector v2(10);

transform(v1.begin(), v1.end(), v2.begin(), bind2nd(ptr_fun (Add),1));

for_each(v2.rbegin(), v2.rend(), Out(cout));cout<

return 0;

}

Program outputs:

Options:

A.

1 2 3 4 5 6 7 8 9 10

B.

2 3 4 5 6 7 8 9 10 11

C.

10 9 8 7 6 5 4 3 2 1

D.

11 10 9 8 7 6 5 4 3 2

E.

compilation error

Viewing page 7 out of 7 pages
Viewing questions 61-70 out of questions
TOP CODES

TOP CODES

Top selling exam codes in the certification world, popular, in demand and updated to help you pass on the first try.