Spring Sale Special Limited Time 70% Discount Offer - Ends in 0d 00h 00m 00s - Coupon code: buysanta

Exact2Pass Menu

CPA - C++ Certified Associate Programmer

Last Update 19 hours ago Total Questions : 257

The CPA - C++ Certified Associate Programmer content is now fully updated, with all current exam questions added 19 hours ago. Deciding to include CPA-21-02 practice exam questions in your study plan goes far beyond basic test preparation.

You'll find that our CPA-21-02 exam questions frequently feature detailed scenarios and practical problem-solving exercises that directly mirror industry challenges. Engaging with these CPA-21-02 sample sets allows you to effectively manage your time and pace yourself, giving you the ability to finish any CPA - C++ Certified Associate Programmer practice test comfortably within the allotted time.

Question # 41

Which code line instead of the comment below will cause the program to produce the expected output?

A.

a = b * c;

B.

return a = b * c;

C.

return a = b * *c;

D.

a = b * *c;

Question # 42

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

#include < iostream >

using namespace std;

class Base {

int age;

public:

class C {

int b;

void PrintC() { cout < < b; }

};

Base () {age=5;};

void setAge(int a=20) {age = a;}

void Print() { cout < < age;}

};

int main () {

Base a;

a.setAge(10);

a.Print();

return 0;

}

A.

It prints: 1020

B.

It prints: 105

C.

It prints: 10

D.

It prints: 20

Question # 43

Which definitions are correct?

A.

int age;

B.

int double;

C.

char c;

D.

int char;

Question # 44

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

#include < iostream >

using namespace std;

int main()

{

int *a= new int;

*a=100;

cout < < *a;

delete a;

}

A.

It prints: 1

B.

It prints: 100

C.

It prints: 0

D.

It prints: 10

Question # 45

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

#include < iostream >

using namespace std;

int main()

{

int i = 0;

do {

i++;

if (i==3)

break;

cout < < i;

}

while(i < 5);

return 0;

}

A.

It prints: 12

B.

It prints: 1

C.

It prints: 0

D.

No output

Question # 46

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

#include < iostream >

using namespace std;

#define DEF_A 0

#define DEF_B DEF_A+1

#define DEF_C DEF_B+1

int main(int argc, char *argv[]) {

cout < < DEF_C;

return 0;

}

A.

It prints: 2

B.

It prints: 10

C.

It prints: 0

D.

It prints: 1

Question # 47

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

#include < iostream >

using namespace std;

int main (int argc, const char * argv[])

{

int a = 30, b = 1, c = 5, i=10;

i = b < a < c;

cout < < i;

return 0;

}

A.

compilation fails

B.

It prints: 10

C.

It prints: 0

D.

It prints: 1

Question # 48

What will the variable " age " be in class B?

class A {

int x;

protected:

int y;

public:

int age;

A () { age=5; };

};

class B : public A {

string name;

public:

B () { name= " Bob " ; };

void Print() {

cout < < name < < age;

}

};

A.

public

B.

private

C.

protected

D.

None of these

Question # 49

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

#include < iostream >

using namespace std;

int s(int n);

int main()

{

int a;

a = 3;

cout < < s(a);

return 0;

}

int s(int n)

{

if(n == 0) return 1;

return s(n?1)*n;

}

A.

It prints: 4

B.

It prints: 6

C.

It prints: 3

D.

It prints: 0

Question # 50

What will the variable " age " be in class B?

class A {

int x;

protected:

int y;

public:

int age;

};

class B : protected A {

string name;

public:

void Print() {

cout < < name < < age;

}

};

A.

public

B.

private

C.

protected

D.

None of these

Go to page: