Summer Certification Limited Time 70% Discount Offer - Ends in 0d 00h 00m 00s - Coupon code = getmirror

Pass the C++ Institute C++ Certified Professional Programmer CPA-21-02 Questions and answers with ExamsMirror

Practice at least 50% of the questions to maximize your chances of passing.
Exam CPA-21-02 Premium Access

View all detail and faqs for the CPA-21-02 exam


788 Students Passed

91% Average Score

96% Same Questions
Viewing page 8 out of 8 pages
Viewing questions 71-80 out of questions
Questions # 71:

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

#include

#include

using namespace std;

class A {

protected:

int y;

public:

int x,z;

A() : x(1), y(2), z(0) { z = x + y; }

A(int a, int b) : x(a), y(b) { z = x + y;}

void Print() { cout << z; }

};

class B : public A {

public:

int y;

B() : A() {}

B(int a, int b) : A(a,b) {}

void Print() { cout << z; }

};

int main () {

A b;

b.Print();

return 0;

}

Options:

A.

It prints: 3

B.

It prints: 0

C.

It prints: 1

D.

It prints: 2

Questions # 72:

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

#include

using namespace std;

class First

{

public:

void Print(){ cout<<"from First";}

};

class Second

{

public:

void Print(){ cout<< "from Second";}

};

int main()

{

First FirstObject;

FirstObject.Print();

Second SecondObject;

SecondObject.Print();

}

Options:

A.

It prints: from First

B.

It prints: from Firstfrom First

C.

It prints: from Firstfrom Second

D.

It prints: from Secondfrom Second

Questions # 73:

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

#include

using namespace std;

void fun(char*);

int main()

{

char t[4]={'0', '1', '2', '3'};

fun(&t[2]);

return 0;

}

void fun(char *a)

{

cout << *a;

}

Options:

A.

It prints: 2

B.

It prints: 21

C.

It prints: 00

D.

It prints: 02

Questions # 74:

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

#include

using namespace std;

int main()

{

int i=2;

switch(i)

{

case 1:

cout<<"Hello";

case 2:

cout<<"world";

case 3:

cout<<"End";

} return 0;

}

Options:

A.

It prints: Hello

B.

It prints: world

C.

It prints: worldEnd

D.

It prints: End

Questions # 75:

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

#include

using namespace std;

class A {

public:

int x;

A() { x=0;}

};

class B : public A {

public:

B() { x=1;}

};

class C : private B {

public:

C() { x=2;}

};

int main () {

C c1;

cout << c1.x;

return 0;

}

Options:

A.

It prints: 210

B.

It prints: 110

C.

It prints: 010

D.

Compilation error

Questions # 76:

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

#include

#include

using namespace std;

class A {

public:

int x;

A() { x=0;}

A(int x) { this?>x=x;}

};

class B : private A {

public:

using A::x;

B() { x=1;}

B(int x) {this?>x = x;}

};

int main () {

B c1;

B c2(?5);

cout << c1.x;

cout << c2.x;

return 0;

}

Options:

A.

It prints: 5

B.

It prints: 1?5

C.

It prints: 05

D.

It prints: 0

Questions # 77:

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

#include

using namespace std;

int main() {

float i = 1.0 / 2 * 2 / 1 * 2 / 4 * 4 / 2;

cout << i;

return 0;

}

Options:

A.

It prints: 0

B.

It prints: 1

C.

It prints: 2

D.

It prints: 0.5

Viewing page 8 out of 8 pages
Viewing questions 71-80 out of questions
TOP CODES

TOP CODES

Top selling exam codes in the certification world, popular, in demand and updated to help you pass on the first try.