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 # 71

What is the output of the program?

#include < iostream >

#include < string >

using namespace std;

union t

{

char c;

int i;

};

class First

{

union t u;

public:

First() {

u.c = ' A ' ;

}

void Print(){

cout < < u.c;

}

};

int main()

{

First *t = new First();

t? > Print();

}

A.

Garbage value

B.

It prints: A

C.

It prints: A 65

D.

Compilation error

Question # 72

What is the output of the program if character “1” is supplied as input?

#include < iostream >

using namespace std;

int main () {

int c;

cin > > c;

try

{

switch (c)

{

case 1:

throw 20;

case 2:

throw 5.2f;

case 3:

throw ' a ' ;

}

}

catch (int e)

{ cout < < " int exception. Exception Nr. " < < e; }

catch (float e)

{ cout < < " float exception. Exception Nr. " < < e; }

catch (...)

{ cout < < " An exception occurred. " ; }

return 0;

}

A.

It prints: float exception. Exception Nr. 5.2

B.

It prints: int exception. Exception Nr. 20

C.

It prints: An exception occurred

D.

Compilation Error

Question # 73

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

A.

ob2.A::print();

B.

ob2 – > A::print();

C.

ob2.B::print();

D.

ob2 – > B::print();

Question # 74

What is the output of the program?

#include < iostream >

using namespace std;

#define SQR(x)(x*x)

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

int x, y=2;

x = SQR(y);

cout < < x < < " , " < < y;

return 0;

}

A.

It prints: 3, 2

B.

It prints: 4, 2

C.

It prints: 3, 3

D.

It prints: 9, 2

Question # 75

What is not inherited from the base class?

A.

constructor

B.

destructor

C.

operator=()

D.

operator+()

Question # 76

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

#include < iostream >

#include < string >

using namespace std;

int main()

{

string s1[]= { " How " , " to " };

s1[0].swap(s1[1] );

for (int i=0; i < 2; i++) {

cout < < s1[i];

}

return( 0 );

}

A.

It prints: Hoto

B.

It prints: toHow

C.

It prints: Ht

D.

It prints: to

Question # 77

What is the output of the program?

#include < iostream >

#include < string >

using namespace std;

int main()

{

string s1= " Wo " ;

string s2;

s2 = s1;

string s3;

s3 = s2.append( " rldHello " );

cout < < s3;

return( 0 );

}

A.

It prints: WorldHello

B.

It prints: HelloWo

C.

It prints: World

D.

It prints: Hello

Go to page: