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

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 First

{

public:

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

};

void fun(First *obj);

int main()

{

First FirstObject;

fun(&FirstObject);

Second SecondObject;

fun(&SecondObject);

}

void fun(First *obj)

{

obj?>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 # 5

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

#include

using namespace std;

class A

{

public:

virtual void Print()=0;

};

class B:public A

{

public:

virtual void Print(){ cout<< "B";}

};

int main()

{

B ob2;

A *obj;

obj = &ob2;

obj?>Print();

}

A.

It prints: B

B.

It prints: A

C.

It prints: AB

D.

It prints: BA

Full Access
Question # 6

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

#include

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

Full Access
Question # 7

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

#include

using namespace std;

class A {

public:

void Print(){ cout<<"A";}

};

class C:public A {

public:

virtual void Print()=0;

};

int main()

{

C obj3;

obj3?>Print();

}

A.

It prints: BB

B.

It prints: A

C.

It prints: AB

D.

Compilation error

Full Access
Question # 8

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

#include

using namespace std;

int compare(int, int);

int main()

{

int x = compare(10, 20);

cout << x;

return 0;

}

int compare(int i, int j)

{

return i

}

A.

It prints: 0

B.

It prints: 2

C.

It prints: 1

D.

It prints: 10

Full Access
Go to page: