Prepare CPA Exam with Using CPA Dump Questions

Category:

Comments:

Post Date:


If you are serious about passing your C++ Institute CPA certification exam, practicing with CPA dumps questions is an essential step in your preparation process. These CPA dumps will help you assess your knowledge, identify your strengths and weaknesses, and improve your chances of passing the exam on the first try. So why wait? Start practicing today and give yourself the best possible chance of success! Test free CPA exam dumps questions below.

Page 1 of 7

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

#include

#include

using namespace std;

class Base

{

string s;

public:

Base() { s="Sample text";}

Base(string s) { this?>s=s; }

void Print() { cout << s; }

};

int main()

{

Base *o = new Base();

o?>Print();

}

2. Which code, inserted at line 19, generates the output "23"?

#include

#include

using namespace std;

class A {

int x;

protected:

int y;

public:

int z;

A() { x=1; y=2; z=3; }

};

class B : public A {

string z;

public:

int y;

void set() { y = 4; z = "John"; }

void Print() {

//insert code here

}

};

int main () {

B b;

b.set();

b.Print();

return 0;

}

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

#include

using namespace std;

void set(struct person*);

struct person

{

int age;

};

int main()

{

struct person e = {18};

set(&e);

cout<< e.age;

return 0;

}

void set(struct person *p)

{

p?>age = p?>age + 1;

}

4. Which statement should be added in the following program to make work it correctly?

using namespace std;

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

{

cout<<"Hello";

}

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

#include

using namespace std;

class complex{

double re;

double im;

public:

complex() : re(0),im(0) {}

complex(double x) { re=x,im=x;};

complex(double x,double y) { re=x,im=y;}

void print() { cout << re << " " << im;}

};

int main(){

complex c1;

double i=2;

c1 = i;

c1.print();

return 0;

}

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

#include

using namespace std;

int op(int x, int y);

float op(int x, float y);

int main()

{

int i=1, j=2, k;

float f=0.3;

k = op(i, j);

cout<< k << "," << op(0, f);

return 0;

}

int op(int x, int y)

{

return x+y;

}

float op(int x, float y)

{

return x?y;

}

7. What is the output of the program?

#include

using namespace std;

class Base {

static int age;

public:

Base () {};

~Base () {};

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

void Print() { cout << age;}

};

int Base::age=0;

int main () {

Base a,*b;

b = new Base();

a.setAge();

b?>setAge(20);

a.Print();

b?>Print();

return 0;

}

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

#include

using namespace std;

int main()

{

int x=2, *y, z=3;

y = &z;

cout<
return 0;

}

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

#include

#include

using namespace std;

class complex{

double re, im;

public:

complex() : re(1),im(0.4) {}

complex operator?(complex &t);

void Print() { cout << re << " " << im; }

};

complex complex::operator? (complex &t){

complex temp;

temp.re = this?>re ? t.re;

temp.im = this?>im ? t.im;

return temp;

}

int main(){

complex c1,c2,c3;

c3 = c1 ? c2;

c3.Print();

}

10. 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;

}


 

TAGS:

Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments

Related

Posts