Free C++ Institute CPP-22-02 Exam Questions

Become C++ Institute Certified with updated CPP-22-02 exam questions and correct answers

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

What happens when you attempt to compile and run the following code? #include  #include  #include  using namespace std; int main(){ int t[] ={ 3, 4, 2, 1, 6, 5, 7, 9, 8, 0 }; vectorv(t, t+10); multiset s1(v.begin(),v.end()); s1.insert(v.begin(),v.end()); pair::iterator,multiset::iterator> range; range = s1.equal_range(6); while (range.first != range.second) { cout<<*range.first<<" "; range.first++; } return 0; }


Answer: A
Question 2

What happens when you attempt to compile and run the following code? #include  #include  #include  #include  using namespace std; void myfunction(int i) { cout << " " << i; } int multiply (int a) { return a*2; } int main() { int t[] = { 10, 5, 9, 6, 2, 4, 7, 8, 3, 1 }; vector v1(t, t+10); set s1(t, t+10); transform(s1.begin(), s1.end(), v1.begin(), multiply); transform(v1.begin(), v1.end(), s1.begin(), multiply); for_each(s1.begin(), s1.end(), myfunction); return 0; }Program outputs:


Answer: D
Question 3

What will happen when you attempt to compile and run the code below, assuming that you enter the following sequence: 1 2 3 end? #include  #include  #include  #include  using namespace std; templatestruct Out { ostream & out; Out(ostream & o): out(o){} void operator() (const T & val ) {out< l; for( ; !cin.bad() ; ) { int i; cin>>i; l.push_back(i); } for_each(l.begin(), l.end(), Out(cout)); return 0;}Program will output:


Answer: A
Question 4

What happens when you attempt to compile and run the following code? #include  #include  #include  #include  using namespace std; void myfunction(int i) { cout << " " << i; } struct sequence { int val,inc; sequence(int s, int i):val(s),inc(i){} int operator()(){ int r = val; val += inc; return r; } }; int main() { vector v1(10);fill(v1.begin(), v1.end(), sequence(1,1)); for_each(v1.begin(), v1.end(), myfunction); return 0; }Program outputs:


Answer: D
Question 5

What happens when you attempt to compile and run the following code? #include  #include  #include  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 valstruct Out { ostream & out; Out(ostream & o): out(o){} void operator() (const T & val ) { out< 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(cout));cout<


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

© Copyrights DumpsCertify 2026. All Rights Reserved

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