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

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

{

Second t[2];

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

t[i].Print();

}

A.

It prints: from First

B.

It prints: from Firstfrom First

C.

It prints: from Secondfrom Second

D.

It prints: from Second

Full Access
Question # 10

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) {}

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(2,5);

b.Print();

return 0;

}

A.

It prints: 10

B.

It prints: 2

C.

It prints: 5

D.

It prints: 1

Full Access
Question # 11

What will the variable "y" 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

Full Access
Question # 12

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

#include

using namespace std;

int main()

{

int i = 0;

do {

i++;

if (i==3)

break;

cout<

}

while(i < 5);

return 0;

}

A.

It prints: 12

B.

It prints: 1

C.

It prints: 0

D.

No output

Full Access
Question # 13

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

#include

using namespace std;

void print(char *c);

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

{

print("Test");

return 0;

}

void print(char *c)

{

cout<

}

A.

It prints: Test

B.

It prints: T

C.

It prints: st

D.

None of these

Full Access
Question # 14

Which of the following is a correct way to define the function fun() in the program below?

#include

#include

#include

using namespace std;

int main()

{

int a[2][2];

fun(a);

return 0;

}

A.

void fun(int *p[2]) {}

B.

void fun(int *p[2][2]) {}

C.

void fun(int *p[][2]) {}

D.

void fun(int p[][2]) {}

Full Access
Question # 15

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

#include

#include

using namespace std;

class First

{

string *s;

public:

First() { s = new string("Text");}

~First() { delete s;}

void Print(){ cout<<*s;}

};

int main()

{

First FirstObject;

FirstObject.Print();

FirstObject.~First();

}

A.

It prints: Text

B.

Compilation error

C.

Runtime error.

D.

None of these

Full Access
Question # 16

Which of the following can be checked in a switch?case statement?

A.

char

B.

int

C.

enum

D.

double

Full Access
Go to page: