CPP Exam Questions & Answers

Exam Code: CPP

Exam Name: C++ Certified Professional Programmer

Updated:

Q&As: 228

At Passcerty.com, we pride ourselves on the comprehensive nature of our CPP exam dumps, designed meticulously to encompass all key topics and nuances you might encounter during the real examination. Regular updates are a cornerstone of our service, ensuring that our dedicated users always have their hands on the most recent and relevant Q&A dumps. Behind every meticulously curated question and answer lies the hard work of our seasoned team of experts, who bring years of experience and knowledge into crafting these premium materials. And while we are invested in offering top-notch content, we also believe in empowering our community. As a token of our commitment to your success, we're delighted to offer a substantial portion of our resources for free practice. We invite you to make the most of the following content, and wish you every success in your endeavors.


Download Free C++ Institute CPP Demo

Experience Passcerty.com exam material in PDF version.
Simply submit your e-mail address below to get started with our PDF real exam demo of your C++ Institute CPP exam.

Instant download
Latest update demo according to real exam

*Email Address

* Our demo shows only a few questions from your selected exam for evaluating purposes

Free C++ Institute CPP Dumps

Practice These Free Questions and Answers to Pass the C++ Certified Associate Programmer Exam

Questions 1

What happens when you attempt to compile and run the following code? Choose all that apply.

#include

#include

#include

#include

#include

#include

using namespace std;

templatestruct Out {

ostream and out;

Out(ostream and o): out(o){}

void operator() (const T and val ) {out<

int main () {

int t[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};

fstream f("test.out", ios::trunc|ios::out);

list l(t, t+10);

for_each(l.begin(), l.end(), Out(f));

f.close(); f.open("test.out");

for( ; f.good() ; ) {

int i; f>>i;

cout<

}

f.close();

return 0;

}

A. file test.out will be opened writing

B. file test.out will be truncated

C. file test.out will be opened for reading

D. no file will be created nor opened

E. program will display sequence 1 2 3 4 5 6 7 8 9 10

Show Answer
Questions 2

What happens when you attempt to compile and run the following code?

include

#include

#include

#include

#include

using namespace std;

int main() {

int t[] = { 10, 5, 9, 6, 2, 4, 7, 8, 3, 1 };

vector v1(t, t + 10);

deque d1(t, t + 10);

set s1(t, t + 10);

cout<

return 0;

}

A. program outputs: 6 6 6

B. program outputs: 3 3 5

C. program outputs: 3 6 5

D. compilation error

E. none of these

Show Answer
Questions 3

What happens when you attempt to compile and run the following code?

#include

#include

#include

#include

#include

using namespace std;

struct display {

void operator() (int i) {cout << " " << i;}

};

int main() {

int t[] = { 10, 5, 9, 6, 2, 4, 7, 8, 3, 1 };

vector v1(t, t + 10);

deque d1(t, t + 10);

set s1(t, t + 10);

for_each(v1.begin(), v1.end(), display); //Line I

for_each(d1.begin(), d1.end(), *(new display())); // Line II

for_each(s1.begin(), s1.end(), display()); // Line III

return 0;

}

A. program outputs: 10 5 9 6 2 4 7 8 3 1 10 5 9 6 2 4 7 8 3 1 1 2 3 4 5 6 7 8 9 10

B. program outputs: 10 5 9 6 2 4 7 8 3 1 10 5 9 6 2 4 7 8 3 1 10 5 9 6 2 4 7 8 3 1

C. compilation error in line I

D. compilation error in line II

E. compilation error in line III

Show Answer
Questions 4

What happens when you attempt to compile and run the following code?

#include

using namespace std;

int main()

{

cout<

return 0;

}

Program outputs:

A. true false

B. 1 0

C. 1 false

D. true 0

E. compilation error

Show Answer
Questions 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=0):val(v){}

int getV() const {return val;}

operator int () const { return val;} };

ostream and operator <<(ostream and out, const B and v) { out<struct Out {

ostream and out;

Out(ostream and o): out(o){}

void operator() (const T and val ) { out<

struct Add {

B operator()(B and a, B and b) { return a+b; } };

int main() {

B t[]={1,2,3,4,5,6,7,8,9,10};

vector v1(t, t+10);

vector v2(10);

transform(v1.begin(), v1.end(), v2.begin(), bind2nd(Add(),1));

for_each(v2.rbegin(), v2.rend(), Out(cout));cout<

return 0;

}

Program outputs:

A. 1 2 3 4 5 6 7 8 9 10

B. 2 3 4 5 6 7 8 9 10 11

C. 10 9 8 7 6 5 4 3 2 1

D. 11 10 9 8 7 6 5 4 3 2

E. compilation error

Show Answer

Viewing Page 1 of 3 pages. Download PDF or Software version with 228 questions