Pass CPP-22-02 Exam in 2026: Comprehensive C++ Certified Professional Programmer CPP-22-02 Dumps (V8.02) + Free Dumps (Part 1, Q1-Q40)

Earning the CPP certification demonstrates your proficiency in STL containers, algorithms, iterators, functional programming tools, smart pointers, templates, advanced I/O manipulation, and modern C++ language features. DumpsBase’s comprehensive CPP-22-02 dumps (V8.02) make passing the C++ Certified Professional Programmer exam easier. Our CPP-22-02 dumps (V8.02) include 228 practice questions and answers that cover all essential exam topics, ensuring you’re fully prepared to demonstrate your skills. Expert-designed Q&As align perfectly with the certification requirements and exam objectives. DumpsBase provides everything you need to pass your CPP-22-02 exam confidently on your first attempt. We’re sharing free dumps so you can check the quality—today we’re releasing the first part.

Below are our CPP-22-02 free dumps (Part 1, Q1-Q40) of V8.02 for checking:

1. Which changes, introduced independently, will allow the code to compile and display “one” “eight”

“nine” “ten”? Choose all that apply

#include <iostream>

#include <map>

#include <string>

using namespace std;

class A {

int a;

public:

A(int a):a(a){}

int getA() const { return a;}

/* Insert Code Here 1 */

};

/* Insert Code Here 2 */

int main(){

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

string s[] = {"three", "four", "two", "one", "six","five", "seven", "nine","eight","ten"};

map<A, string> m;/* Replace Code Here 3 */

for(int i=0; i<10; i++) {

m.insert(pair<A,string>(A(t[i]),s[i]));

}

m.erase(m.lower_bound(2),m.upper_bound(7));

map<A, string>::iterator i=m.begin(); /* Replace Code Here 4 */

for( ;i!= m.end(); i++) {

cout<<i?>second<<" ";

}

cout<<endl;

return 0;

}

2. Given three files: class.h, class.cpp and main.cpp containing small C++ project, which sentences

are TRUE if you attempt to compile and run the program? Assume that the whole compiling

environment is properly set.

// File: main.cpp

#include <iostream>

#include "class.h"

using namespace std;

int main()

{

A<int> a;

cout << a.getV() << endl;

return 0;

}

//File: class.h

#ifndef _CLASS_

#define _CLASS_

template <class T>

class A {

T_v;

public:

A() {}

A(T v);

T getV();

};

#endif

//File: class.cpp

#include "class.h"

template<typename T>

A<T>::A(T v):_v(v) {}

template<class T>

T A<T>::getV() { return _v; }

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

#include <vector>

#include <iostream>

#include <algorithm>

using namespace std;

class B { int val;

public:

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

int getV() const {return val;}

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

template<class T>struct Out {

ostream & out;

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

void operator() (const T & val ) { out<<val<<" "; } };

struct Add {

B operator()(B & a, B & b) { return a+b; }};

int main() {

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

vector<B> v1(t, t+10);

vector<B> v2(10);

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

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

return 0;

}

Program outputs:

4. Which pieces of code inserted independently into places marked 1 and 2 will cause the program to

compile and display: 0 1 2 3 4 5 6 7 8 9? Choose all that apply.

#include <list>

#include <iostream>

using namespace std;

class A { int a; public:

A(int a){ this?>a=a;}

//insert code here 1

};

//insert code here 2

template<class T> void print(T start, T end) {

while (start != end) {

std::cout << *start << " "; start++;

}

}

int main() {

A t1[] ={ 1, 7, 8, 4, 5 };list<A> l1(t1, t1 + 5);

A t2[] ={ 3, 2, 6, 9, 0 };list<A> l2(t2, t2 + 5);

l1.sort();l2.sort();l1.merge(l2);

print(l1.begin(), l1.end());

print(l2.begin(), l2.end()); cout<<endl;

return 0;

}

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

#include <vector>

#include <iostream>

#include <algorithm>

using namespace std;

template<class T>struct Out {

ostream & out;

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

void operator() (const T & val ) { out<<val<<" "; } };

int main() {

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

int t2[]={5,6,8,2,1};

vector<int> v1(10);

sort(t1, t1+5);

sort(t2, t2+5);

set_intersection(t1,t1+5,t2,t2+5,v1.begin());

for_each(v1.begin(), v1.end(), Out<int>(cout));cout<<endl;

return 0;

}

Program outputs:

6. Which stack initialization (line numbers) are correct? Choose all that apply.

#include <iostream>

#include <deque>

#include <list>

#include <stack>

#include <vector>

using namespace std;

int main()

{

deque<int> mydeck;

list<int> mylist;

vector<int> myvector;

stack<int> first;// Line I

stack<int> second(mydeck);// Line II

stack<int> third(second);// Line III

stack<int, list<int> > fourth(mylist);// Line IV

stack<int, vector<int> > fifth(myvector);// Line V

return 0;

}

7. What will happen when you attempt to compile and run the code below, assuming that you enter

the following sequence: one two three<enter>?

#include <iostream>

#include <string>

using namespace std;

int main ()

{

string a;

cin>>a;

cout<<a<<endl;

return 0;

}

Program will output:

8. Which sentence is correct about the code below?

#include <iostream>

#include <algorithm>

#include <vector>

using namespace std;

class A {

int a;

public:

A(int a) : a(a) {}

int getA() const { return a; }

void setA(int a) { this?>a = a; }

/* Insert Code Here */

};

struct add10 { void operator()(A & a) { a.setA(a.getA() + 10); } };

int main() {

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

vector<A> v1(t, t + 10);

for_each(v1.begin(), v1.end(), add10());

vector<A>::iterator it = find(v1.begin(), v1.end(), A(7));

cout << it?>getA() << endl;

return 0;

}

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

#include <iostream>

#include <map>

using namespace std;

int main() {

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

string s[] = { "one", "one", "two", "two", "three","three", "four", "four", "five", "five"};

map<int, string> m;

for (int i = 0; i < 10; i++) {

m.push_back(pair<int, string>(t[i], s[i]));

}

for (map<int, string>::iterator i = m.begin(); i != m.end(); i++) {

cout << i?>first << " ";

}

return 0;

}

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

#include <deque>

#include <iostream>

#include <algorithm>

using namespace std;

class B { int val;

public:

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

int getV() const {return val;} bool operator < (const B & v) const { return val<v.val;} };

ostream & operator <<(ostream & out, const B & v) { out<<v.getV(); return out;}

template<class T>struct Out {

ostream & out;

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

void operator() (const T & val ) { out<<val<<" "; } };

int main() {

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

deque<B> d1(t, t+10);

sort(d1.begin(), d1.end());

deque<B>::iterator it = upper_bound(d1.begin(), d1.end(), B(4));

for_each(it, d1.end(), Out<B>(cout)); cout<<endl;

return 0;

}

Program outputs:

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

#include <vector>

#include <iostream>

#include <algorithm>

using namespace std;

class B { int val;

public:

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

int getV() const {return val;} bool operator < (const B & v) const { return val<v.val;} };

ostream & operator <<(ostream & out, const B & v) { out<<v.getV(); return out;}

template<class T>struct Out {

ostream & out;

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

void operator() (const T & val ) { out<<val<<" "; } };

int main() {

B t1[]={3,2,4,1,5};

int t2[]={5,6,8,2,1};

vector<B> v1(10,0);

sort(t1, t1+5);

sort(t2, t2+5);

set_union(t1,t1+5,t2,t2+5,v1.begin());

for_each(v1.begin(), v1.end(), Out<B>(cout));cout<<endl;

return 0;

}

Program outputs:

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

#include <vector>

using namespace std;

int main ()

{

std::vector<int>v1;

v1.push_back(10);

return 0;

}

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

#include <iostream>

#include <string>

using namespace std;

template <class T>

class A {

T_v;

public:

A() {}

A(T v): _v(v){}

T getV() { return _v; }

void add(T & a) { _v+=a; }

void add(string & a) {

_v.insert(0, a);

}

};

int main()

{

A<string>a("Hello");

string s(" world!");

a.add(s);

cout << a.getV() <<endl;

return 0;

}

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

#include <deque>

#include <list>

#include <iostream>

using namespace std;

int main ()

{

list<int>l1;

deque<int>d1;

for(int i=0; i<5; i++)

{

l1.push_back(i);l1.push_front(i);

d1.push_back(i);d1.push_front(i);

}

for(int i=0; i<d1.size(); i++)

{

cout<<d1[i]<<" "<<l1[i]<<" ";

}

cout<<endl;

return 0;

}

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

#include <deque>

#include <vector>

#include <iostream>

#include <string>

using namespace std;

template<typename T>

void print(T start, T end)

{

while (start != end)

cout<<*start++;

}

int main ()

{

string t[] = {"one", "two" ,"three" ,"four", "five"};

vector<string>v1(t, t+5);

deque<string>d1(v1.rbegin(), v1.rend());

d1.push_back("zero");

print(d1[0].rbegin(),d1[0].rend());

return 0;

}

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

#include <iostream>

#include <algorithm>

#include <vector>

using namespace std;

int main () {

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

vector<int> v (t,t+10);

vector<int>::iterator it;

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

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

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

return 0;

}

Program outputs:

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

#include <iostream>

#include <algorithm>

#include <deque>

using namespace std;

class A {

int a;

public:

A(int a) : a(a) {}

int getA() const { return a; } void setA(int a) { this?>a = a; }

};

int main () {

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

deque<int> d (t,t+15);

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

cout<< number<<endl;

return 0;

}

Program outputs:

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

#include <iostream>

#include <algorithm>

#include <vector>

using namespace std;

int main () {

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

vector<int> v (t,t+10);

vector<int>::iterator it;

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

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

if (it != v.end())

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

return 0;

}

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

#include <iostream>

#include <fstream>

#include <string>

#include <list>

#include <algorithm>

#include <iomanip>

using namespace std;

class B { int val;

public:

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

int getV() const {return val;}

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

template<class T>struct Out {

ostream & out;

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

void operator() (const T & val ) {out<<setw(3)<<hex<<val; } };

int main () {

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

fstream f("test.out", ios::trunc|ios::out);

list<B> l(t, t+10);

for_each(l.begin(), l.end(), Out<B>(f));

f.close();

f.open("test.out");

for( ; f.good() ; ) {

B i;

f>>i;

cout<<i<<" ";

}

f.close();

return 0;

}

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

#include <iostream>

#include <algorithm>

#include <vector>

#include <deque>

#include <set>

using namespace std;

struct display {

void operator() (int i) {cout << " " << i;}

};

int main() {

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

vector<int> v1(t, t + 10);

deque<int> d1(t, t + 10);

set<int> s1(t, t + 10);

for_each(v1.begin(), v1.end(), display); //Line I

for_each(d1.begin(), d1.end(), *(new display())); // Line II

for_each(s1.begin(), s1.end(), display()); // Line III

return 0;

}

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

#include <vector>

#include <iostream>

#include <algorithm>

using namespace std;

template<class T>struct Out {

ostream & out;

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

void operator()(const T & val ) {

out<<val<<" ";

}

};

struct Sequence {

int start;

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

int operator()() {

return start++ ; }};

int main() {

vector<int> v1(10);

generate(v1.rbegin(), v1.rend(), Sequence(1));

rotate(v1.begin(),v1.begin() + 1, v1.end() );

for_each(v1.begin(), v1.end(), Out<int>(cout) );cout<<endl;

return 0;

}

Program outputs:

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

#include <list>

#include <iostream>

#include <deque>

using namespace std;

template<class T> void print(T start, T end) {

while (start != end) {

std::cout << *start << " "; start++;

}

}

class A {

int a;

public:

A(int a):a(a){}

operator int () const { return a;}int getA() const { return a;}

};

struct R {

int val;

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

bool operator ()(const A & a) { return a>val;} };

int main() {

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

list<A> l1(t1, t1 + 10);

R r(4);l1.remove_if(r);

print(l1.begin(), l1.end()); cout<<endl;

return 0;

}

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

#include <vector>

#include <iostream>

#include <algorithm>

#include <functional>

using namespace std;

template<class T>struct Out {

ostream & out;

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

void operator() (const T & val ) { out<<val<<" "; } };

int Add(int a, int b) {

return a+b;

}

int main() {

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

vector<int> v1(t, t+10);

vector<int> v2(10);

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

vector<int>::iterator it = find_if(v2.begin(), v2.end(),bind2nd(equal_to<int>(),10));

cout<<*it<<endl;

return 0;

}

Program outputs:

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

#include <vector>

#include <iostream>

#include <algorithm>

using namespace std;

template<class T>struct Out {

ostream & out;

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

void operator() (const T & val ) { out<<val<<" "; } };

int main() {

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

int t2[]={6,10,8,7,9};

vector<int> v1(10);

sort(t1, t1+5); sort(t2, t2+5);

copy(t1,t1+5,v1.begin());

copy(t2,t2+5,v1.begin()+5);

merge(v1.begin(), v1.begin()+5,v1.end());

for_each(v1.begin(), v1.end(), Out<int>(cout));cout<<endl;

return 0;

}

Program outputs:

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

#include <iostream>

#include <algorithm>

#include <vector>

using namespace std;

void myfunction(int i) {

cout << " " << i;

}

void multiply (int a) {

a*2;

}

int main() {

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

vector<int> v1(t, t+10);

for_each(v1.begin(), v1.end(), multiply);

iter_swap(v1.begin(),t+9);

for_each(v1.begin(), v1.end(), myfunction);

return 0;

}

Program outputs:

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

#include <iostream>

#include <algorithm>

#include <vector>

#include <deque>

using namespace std;

void myfunction(int i) {

cout << " " << i;

}

int main() {

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

deque<int> d1(t, t+10);

vector<int> v1(d1.rbegin(), d1.rend());

sort(d1.begin(), d1.end());

swap_ranges(v1.begin(), v1.end(), d1.begin());

for_each(v1.begin(), v1.end(), myfunction);

for_each(d1.begin(), d1.end(), myfunction);

return 0;

}

Program outputs:

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

#include <vector>

#include <iostream>

#include <algorithm>

#include <functional>

using namespace std;

template<class T>struct Out {

ostream & out;

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

void operator() (const T & val ) { out<<val<<" "; } };

struct Add : public binary_function<int, int, int> {

int operator() (const int & a, const int & b) const {

return a+b;

}

};

int main() {

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

vector<int> v1(t, t+10);

vector<int> v2(10);

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

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

return 0;

}

Program outputs:

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

#include <iostream>

#include <algorithm>

#include <map>

using namespace std;

int main() {

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

map<int, int> m;

for(int i=0; i < 10; i++) {

m[i]=t[i];

}

pair<const int,int> p(5,5);

map<int, int>::iterator it = find(m.begin(), m.end(), p);

if (it != m.end())

{

cout<<it?>first<<endl;

}

else

{

cout<<"Not found!n";

}

return 0;

}

Program outputs:

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

#include <iostream>

using namespace std;

int main()

{

cout.setf(ios::hex, ios::basefield);

cout<<100<<" ";

cout.flags(ios::showbase);

cout<<100<<" ";

return 0;

}

Program outputs:

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

#include <iostream>

#include <set>

#include <list>

using namespace std;

int main(){

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

list<int>v(t, t+10);

set<int> s1(v.begin(),v.end());

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

s1.erase(3);

}

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

cout<<*i<<" ";

}

return 0;

}

31. What happens when you attempt to compile and run the following code? Choose all that apply.

#include <iostream>

#include <fstream>

#include <string>

#include <list>

#include <algorithm>

#include <iomanip>

using namespace std;

class B { int val;

public:

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

int getV() const {return val;}

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

template<class T>struct Out {

ostream & out;

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

void operator() (const T & val ) {out<<setw(3)<<hex<<val; } };

int main () {

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

fstream f("test.out", ios::trunc|ios::out);

list<B> l(t, t+10);

for_each(l.begin(), l.end(), Out<B>(f));

f.close();

f.open("test.out");

for( ; f.good() ; ) {

int i;

f>>i;

cout<<i<<" ";

}

f.close();

return 0;

}

32. What will happen when you attempt to compile and run the following code?

#include <iostream>

#include <map>

#include <vector>

#include <sstream>

#include <string>

using namespace std;

int main() {

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

vector<int> v(t, t + 10);

multimap<int, string> m;

for (vector<int>::iterator i = v.begin(); i != v.end(); i++) {

stringstream s;s << *i << *i;

m.insert(pair<int, string>(*i, s.str()));

}

pair<multimap<int, string>::iterator, multimap<int, string>::iterator> range;

range = m.equal_range(2);

for (multimap<int, string>::iterator i = range.first; i != range.second; i++) {

cout << i?>first << " ";

}

return 0;

}

The output will be:

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

#include <deque>

#include <vector>

#include <iostream>

using namespace std;

int main ()

{

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

vector<int> v1(t, t + 10);

deque<int> d1(v1.begin(), v1.end());

deque<int> d2;

d2 = d1;

d2.insert(d1.rbegin(), 10);

for(int i = 0; i<d1.size(); i++)

{

cout<<d1[i]<<" ";

}

return 0;

}

34. Which changes introduced independently will allow the code to compile and display 0 0 1 1 8 8 9 9

(choose all that apply)?

#include <iostream>

#include <set>

#include <vector>

using namespace std;

class A {

int a;

public:

A(int a):a(a){}

int getA() const { return a;}

/* Insert Code Here 1 */

};

/* Insert Code Here 2*/

int main(){

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

set<A>s(t, t+10);/* Replace Code Here 3 */

multiset<A> s1(s.begin(),s.end());/* Replace Code Here 4 */

s1.insert(s.begin(),s.end());

s1.erase(s1.lower_bound(2),s1.upper_bound(7));

multiset<A>::iterator i=s1.begin();/* Replace Code Here 5 */

for( ;i!= s1.end(); i++)

{

cout<<i?>getA()<<" ";

}

cout<<endl;

return 0;

}

35. What happens when you attempt to compile and run the following code? Choose all that apply.

#include <iostream>

#include <fstream>

#include <string>

#include <list>

#include <algorithm>

#include <iomanip>

using namespace std;

template<class T>struct Out {

ostream & out;

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

void operator() (const T & val ) {out<<setw(3)<<hex<<val; } };

int main () {

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

fstream f("test.out", ios::trunc|ios::out);

list<int> l(t, t+10);

for_each(l.begin(), l.end(), Out<int>(f));

f.close(); f.open("test.out");

for( ; f.good() ; ) {

int i; f>>i;

cout<<i<<" ";

}

f.close();

return 0;

}

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

#include <list>

#include <iostream>

using namespace std;

template<class T>

void print(T start, T end) {

while (start != end) {

std::cout << *start << " "; start++;

}

}

int main()

{

int t1[] ={ 1, 7, 8, 4, 5 };

list<int> l1(t1, t1 + 5);

int t2[] ={ 3, 2, 6, 9, 0 };

list<int> l2(t2, t2 + 5);

l1.sort();

list<int>::iterator it = l2.begin();

it++; it++;

l1.splice(l1.end(),l2, it, l2.end());

print(l1.begin(), l1.end()); cout<<"Size:"<<l1.size()<<" ";

print(l2.begin(), l2.end()); cout<<"Size:"<<l2.size()<<endl;

return 0;

}

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

#include <iostream>

#include <algorithm>

#include <vector>

using namespace std;

int main () {

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

vector<int> v (t,t+15);

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

cout<< number<<endl;

return 0;

}

Program outputs:

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

#include <vector>

#include <iostream>

int main ()

{

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

std::vector<int>v1(t,t+5);

std::vector<int>v2(v1);

v1.resize(10);

v2.reserve(10);

std::vector<int>::iterator i = v1.begin();int ii = 0;

while (i != v1.end()) { std::cout<<i[ii]<<" ";ii??;i++; }

i = v2.begin();ii=0;

while (i != v2.end()) { std::cout<<i[ii]<<" ";ii??;i++; }

return 0;

}

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

include <iostream>

#include <algorithm>

#include <vector>

#include <deque>

#include <set>

using namespace std;

int main() {

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

vector<int> v1(t, t + 10);

deque<int> d1(t, t + 10);

set<int> s1(t, t + 10);

cout<<find(v1.begin(), v1.end(), 6)<<" "<<find(d1.begin(), d1.end(), 6)<<" "<<find(s1.begin(),

s1.end(), 6);

return 0;

}

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

#include <iostream>

#include <map>

#include <vector>

#include <sstream>

#include <string>

using namespace std;

int main(){

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

vector<int> v(t, t+10);

multimap<int,string> m;

for(vector<int>::iterator i=v.begin(); i!=v.end(); i++) {

stringstream s; s<<*i<<*i; m.insert(pair<int,string>(*i,s.str()));

}

for(multimap<int, string>::iterator i=m.begin();i!= m.end(); i++) {

cout<<*i<<" ";

}

return 0;

}


 

Get the CLP-12-01 Dumps (V8.02) - Achieve Excellence in the CLP – C Certified Professional Programmer Certification

Add a Comment

Your email address will not be published. Required fields are marked *