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

Note! Following CPA Exam is Retired now. Please select the alternative replacement for your Exam Certification. The new exam code is CPA-21-02

CPA Exam Dumps - C++ Certified Associate Programmer

Go to page:
Question # 17

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

#include

using namespace std;

int main()

{

int x=0;

int *ptr;

ptr = &x;

cout<

return 0;

}

A.

It prints: 0 0

B.

It prints address of ptr

C.

It prints: 1

D.

It prints: 2

Full Access
Question # 18

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

#include

using namespace std;

int main()

{

int x,y=10;

float f;

f = 5.20;

x=(int) f;

cout << x <<", ";

f=float (y);

cout << f;

return 0;

}

A.

It prints: 5, 10

B.

It prints: 5.2, 10

C.

It prints: 5.20, 10.0

D.

It prints: 5.2, 10.00

Full Access
Question # 19

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();

}

A.

It prints: from First

B.

It prints: from Firstfrom First

C.

It prints: from Firstfrom Second

D.

It prints: from Secondfrom Second

Full Access
Question # 20

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

#include

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

Full Access
Question # 21

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

#include

using namespace std;

class Test {

float i,j;

};

class Add {

public:

int x,y;

Add (int a=3, int b=3) { x=a; y=b; }

int result() { return x+y;}

};

int main () {

Test test;

Add * padd;

padd = &test;

cout << padd?>result();

return 0;

}

A.

It prints: 6

B.

It prints: 9

C.

Compilation error

D.

It prints: 33

Full Access
Question # 22

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

#include

#include

using namespace std;

int main()

{

string s1[]= {"H" , "t" };

string s;

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

s = s1[i];

s.insert(1,"o");

cout << s;

}

return( 0 );

}

A.

It prints: Hoto

B.

It prints: Ho

C.

It prints: to

D.

It prints: Ht

Full Access
Question # 23

What is the output of the program?

#include

#include

using namespace std;

int main()

{

string s1="World";

string s2;

s2="Hello" + s1;

cout << s2;

return( 0 );

}

A.

It prints: HelloWorld

B.

It prints: Hello

C.

It prints: World

D.

Compilation error

Full Access
Question # 24

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

#include

using namespace std;

int min(int a, int b);

int main()

{

int b=10;

b = min(5,20);

cout << b;

return 0;

}

int min(int a, int b)

{

if (a

return(a);

else

return(b);

}

A.

It prints: 10

B.

It prints: 20

C.

It prints: 5

D.

It prints: 0

Full Access
Go to page: