×

Special Offer! Sale of the Month | Extra 20% OFF - Ends In Coupon code: TEL20

Why C++ Institute CPP-22-02 Practice Exam Questions?

Ready to level up your C++ Institute CPP-22-02 exam study? Just TheExamsLab CPP-22-02 practice tests free.

CPP-22-02 exam questions are expertly crafted practice tests designed to simulate the real C++ Institute certification exam environment and help you assess your knowledge and figure out where you are lacking. From our free CPP - C++ Certified Professional Programmer CPP-22-02 practice exam, you will feel secure in passing any question type or time limit. TheExamsLab offers the CPP-22-02 exam questions 2024. Don’t settle or do it half-heartedly get the best and invest in the best what you want is what you get.

Page:    1 / 46      
Total 230 Questions | Updated On: Nov 19, 2024
Add To Cart
Question 1

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


Answer: A
Question 2

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);
 multiset<int> s1(v.begin(),v.end());
 if (s1.count(3) == 2) {
 s1.erase(3);
 }
 for(multiset<int>::iterator i=s1.begin();i!= s1.end(); i++) {
 cout<<*i<<" ";
 }
 return 0;
 } 


Answer: D
Question 3

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


Answer: A
Question 4

What happens when you attempt to compile and run the following code?
 #include <deque>
 #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 t[]={8, 10, 5, 1, 4, 6, 2, 7, 9, 3};
 deque<int> d1(t, t+10);
 sort(d1.begin(), d1.end());
 deque<int>::iterator it = upper_bound(d1.begin(), d1.end(), 4);
 for_each(it, d1.end(), Out<int>(cout));cout<<endl;
 return 0;
}
Program outputs:


Answer: A
Question 5

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


Answer: A
Page:    1 / 46      
Total 230 Questions | Updated On: Nov 19, 2024
Add To Cart

© Copyrights TheExamsLab 2024. All Rights Reserved

We use cookies to ensure your best experience. So we hope you are happy to receive all cookies on the TheExamsLab.