Free C++ Institute CPP Exam Practice Questions

    • PDF Questions

      • Exam Code: CPP
      • Exam Name: CPP - C++ Certified Professional Programmer
      • Total Questions: 228
      • PDF Price: $29.50 / $59.00
    • Bundle Pack

      • Exam Code: CPP
      • Exam Name: CPP - C++ Certified Professional Programmer
      • Total Questions: 228
      • Bundle Price: $49.50 / $99
    • Online Engine

      • Exam Code: CPP
      • Exam Name: CPP - C++ Certified Professional Programmer
      • Total Questions: 228
      • Practice Test Price: $34.50 / $69.00
    1. Page: 1/46
      Total 228 Questions
    Question No 1
    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:
    Choose the Choices:


    Question No 2
    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; }
    Choose the Choices:


    Question No 3
    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:
    Choose the Choices:


    Question No 4
    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:
    Choose the Choices:


    Question No 5
    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}; B t2[]={5,6,8,2,1}; vector<B> v1(10,0); 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<B>(cout));cout<<endl; return 0; } Program outputs:
    Choose the Choices:

    Next Question

    1. Page: 1/46
      Total 228 Questions

About This CPP Question Bank

This page has 228 free practice questions for the C++ Institute CPP (CPP - C++ Certified Professional Programmer) exam, last refreshed on 24th Aug 2026. Answer each question, then reveal the correct choice to check your understanding before deciding whether to unlock the full question bank.

The demo above is a sample of the complete CPP question set. The full bank includes the PDF, downloadable practice test, and online exam-engine formats listed above, with free updates included for the duration you choose.

Frequently Asked Questions

How many free CPP questions can I try here?

This demo includes a sample from our 228-question CPP bank so you can check the format and difficulty before purchasing.

Are these CPP questions updated?

Yes, the C++ Institute CPP question bank is reviewed and refreshed periodically to reflect current exam objectives.

What formats are available for the full CPP question bank?

PDF download, an online practice-test engine, and a combined bundle pack with 3, 6, or 12-month free updates.

Is there a refund if I don't pass?

Yes, purchases include a money-back guarantee — see our refund policy for details.