Decide Fast & Get 50% Flat Discount on This Summer Discount Offer | Limited Time Offer - Ends In COUPON CODE: Summer50

CPP Practice Questions

CPP - C++ Certified Professional Programmer Exam Practice Test


Total 46 Pages
Total 228 Questions

CPP Practice Questions

Question# 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# 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# 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# 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# 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:


Note:

Free Questions are not enough! Buy premium files.

If you face any error in this CPP - C++ Certified Professional Programmer Exam questions or answers, get in touch with us via email:

support@exams4success.com
OUR SATISFIED CUSTOMER REVIEWS
SA
Sandra Lucas
Getting certified was my dream since I stepped in a professional world. Exams4success has helped me succeed and I am very thankful to the team behind this. You guys are doing excellent work. Keep it up!
DA
David
Awesome exam dumps for the CPP certification exam. I suggest Exams4success to everyone to take a look at these to prepare. Tried myself and scored excellent marks.
ET
Ethan Cuellar
Passing CPP certification exam was a dream for me and I have finally achieved that. I am extremely thankful to Exams4success for providing such great ways to pass CPP exam.
JO
Jo Cherry
That was my final attempt for CPP - C++ Certified Professional Programmer exam because I have been attempting for CPP certification exam. Thanks to guys behind Exams4success. I stumbled upon their CPP practice material this time and I have finally passed my exam.
JE
Jerry Pridgen
I can’t believe I am a CPP certified now. Exams4success definitely deserves the credit for this and I am very thankful to the CPP experts who are providing such great CPP practice material.
ST
Stefani Keller
I have finally passed CPP certification exam and the big thanks to the people behind Exams4success. They have helped me with CPP mock test which is excellent and high-quality preparation material. Great Job.
LO
Lorri McCartney
That was my final attempt because I have been attempting for this specific certification. Thanks to guys behind ExamsAway. I stumbled upon their practice material this time and I have finally passed my exam.
ST
Steven
I just love Exams4success exam Study Guide for CPP certification exam. It is simple, trouble-free and comprehensible without any help. During your exam preparation, you’ll feel as the material has been written especially for you. I qualified CPP exam with dazzling scores. I recommend it to you with full confidence!
JO
John C. Prince
I have finally passed my certification exam and the big thanks to the people behind Exams4success. They have helped me with their excellent and high-quality preparation material. Great Job.
KA
Karen C. Mejia
You have been doing an excellent job. I just used your CPP exam dumps and passed my examination without any trouble. Thank you for your wonderful services.
WI
William Watson
I passed my CPP exam and got certified. I just got 93% and I can’t believe it. The experts at Exams4success have been doing a great job.
KR
Kristen Pfeiffer
Passing this certification exam was a dream for me and I have finally achieved that. I am extremely thankful to Exams4success for providing such great ways to pass the exam.
RO
Rosa
Thank you team Exams4success for the amazing exam dumps pdf files. Prepared me so well and I was able to get 92% marks in the CPP certification exam.
JO
John Beasley
I am extremely happy right now with the CPP exam results. I just passed my CPP exam using your mock tests and I am very thankful to you guys.

Related Exams Questions


CPA

CPA - C++ Certified Associate Programmer

SEE DETAIL 220 Questions

CPP

CPP - C++ Certified Professional Programmer

SEE DETAIL 228 Questions

CPA-21-02

CPA - C++ Certified Associate Programmer Exam

SEE DETAIL 257 Questions