Confidently Practice Online with Free CPP-22-02 Exam Cram

Practice your CPP - C++ Certified Professional Programmer certification test with free CPP-22-02 exam cram and take control of your certification preparation. At FreeExamCram, you can practice online for free using real CPP-22-02 exam dumps, verified questions, and expert-designed free online practice tests. Moreover our C++ Institute CPP-22-02 exam cram backed by our confidence-boosting refund guarantee.

Exam Code: CPP-22-02
Exam Questions: 230
CPP - C++ Certified Professional Programmer
Updated: 26 Nov, 2025
Viewing Page : 1 - 23
Practicing : 1 - 5 of 230 Questions
Question 1

What happens when you attempt to compile and run the following code?
 #include <iostream>
 #include <map>
 #include <string>
 using namespace std;
 int main(){
 int second[] ={ 3, 4, 2, 1, 6, 5, 7, 9, 8, 10 };
 string first[] = {"three", "four", "two", "one", "six","five", "seven", "nine","eight"," ten"};
 multimap<int,string> m;
 for(int i=0; i<10; i++) {
 m.insert(pair<int,string>(second[i],first[i]));
 }
 if (m[11] == "eleven") {
 cout<<"eleven ";
 }
 for(multimap<int, string>::iterator i=m.begin();i!= m.end(); i++) {
 cout<<i?>second<<" ";
 }cout<<m.size();
 return 0;
 }

Options :
Answer: A

Question 2

What happens when you attempt to compile and run the following code?
 #include <iostream>
 using namespace std;int main()
 {
 cout<<true<<" "<<boolalpha<<false;
 return 0;
 }
Program outputs:

Options :
Answer: C

Question 3

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;
 }

Options :
Answer: D

Question 4

What will be output of the program when you attempt to compile and run the following
code?
 #include <iostream>
 #include <map>
 #include <vector>
 #include <string>
 using namespace std;
 int main(){
 int second[] ={ 3, 4, 2, 1, 6, 5, 7, 9, 8, 0 };
 string first[] = {"three", "four", "two", "one", "six","five", "seven", "nine","eight","zero"};
 multimap<int,string> m;for(int i=0; i<10; i++) {
 m.insert(pair<int,string>(second[i],first[i]));
 }
 m[0]="ten";
 m.insert(pair<int,string>(1,"eleven"));
 for(multimap<int, string>::iterator i=m.begin();i!= m.end(); i++) {
 cout<<i?>second<<" ";
 }
 return 0;
 }

Options :
Answer: A

Question 5

What happens when you attempt to compile and run the following code?
 #include <iostream>
 #include <algorithm>
 #include <vector>
 using namespace std;
 class A {
 int apublic:
 A(int a) : a(a) {}
 int getA() const { return a; } void setA(int a) { this?>a = a; }
 bool operator==(A & b) { return a == b.a; }
 };
 struct Compare{
 bool operator()(const A & a, const A & b) {return a.getA()==b.getA();};
 };
 int main () {
 int t[] = {1,2,3,4,5,1,2,3,4,5};
 vector<A> v (t,t+10);
 vector<A>::iterator it;
 A m1[] = {A(1), A(2), A(3)};
 it = search (v.begin(), v.end(), m1, m1+3, Compare());
 cout << "First found at position: " << it?v.begin() << endl;
 return 0;
 }
Program outputs:

Options :
Answer: B

Viewing Page : 1 - 23
Practicing : 1 - 5 of 230 Questions

© Copyrights FreeExamCram 2025. All Rights Reserved

We use cookies to ensure that we give you the best experience on our website (FreeExamCram). If you continue without changing your settings, we'll assume that you are happy to receive all cookies on the FreeExamCram.