C++ Institute CPA-21-02 CPA - C++ Certified Associate Programmer Exam Practice Test

Page: 1 / 14
Total 257 questions
Question 1

What is the meaning of the following declaration? (Choose two.)

char **ptr;



Answer : A, B


Question 2

Which code line inserted instead of the comment below will fix the program so that it produces the expected output and does not cause any memory leak?



Answer : A


Question 3

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



Answer : C


Question 4

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

#include

using namespace std;

int main()

{

int i = 4;

while(i >= 0) {

cout<

i??;

}

return 0;

}



Answer : A


Question 5

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

#include

#include

using namespace std;

class complex{

double re;

double im;

public:

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

bool operator==(complex &t);

};

bool complex::operator == (complex &t){

if((this?>re == t.re) && (this?>im == t.im))

return true;

else

return false;

}

int main(){

complex c1,c2;

if (c1==c2)

cout << "OK";

else {

cout << "ERROR";

}

}



Answer : A


Question 6

Which definitions are correct?



Answer : A, C


Question 7

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

#include

using namespace std;

int main()

{

int a=5;

cout << ((a < 5) ? 9.9 : 9);

}



Answer : A


Page:    1 / 14   
Total 257 questions