Weekend Sale Special Limited Time 65% Discount Offer - Ends in 0d 00h 00m 00s - Coupon code: bigdisc65

Pass Using CPP Exam Dumps

Page: 8 / 8
Question 32

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

#include

#include

#include

using namespace std;

struct Compare {

bool operator ()(int a) {

if (a >5) return true;

return false;

}

};

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(), Compare());

cout<< number<<endl;

return 0;

}

Program outputs:

Options:

A.

4

B.

3

C.

2

D.

0

E.

compilation error

Question 33

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

#include

#include

#include

#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 v1(t, t + 15);

set s1(t, t + 15);

pair::iterator, vector::iterator > resultSet = mismatch(s1.begin(), s1.end(), v1.begin());

cout<<*resultSet.first<<" "<<*resultSet.second<<endl;

return 0;

}

Program outputs:

Options:

A.

2 4

B.

4 2

C.

0 5

D.

compilation error

Question 34

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

#include

#include

#include

using namespace std;

int main(){

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

listv(t, t+10);

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

if (s1.count(3) == 2) {

s1.erase(3);

}

for(set::iterator i=s1.begin();i!= s1.end(); i++) {

cout<<*i<<" ";

}

return 0;

}

Options:

A.

program outputs: 1 2 3 4 5

B.

program outputs: 1 2 4 5

C.

program outputs: 1 1 2 2 3 4 4 5 5

D.

program outputs: 1 1 2 3 3 4 4 5 5

E.

compilation error

Page: 8 / 8
Exam Code: CPP
Exam Name: C++ Certified Professional Programmer
Last Update: May 18, 2024
Questions: 228
CPP pdf

CPP PDF

$28  $80
CPP Engine

CPP Testing Engine

$33.25  $95
CPP PDF + Engine

CPP PDF + Testing Engine

$45.5  $130