Pass4Future also provide interactive practice exam software for preparing C++ Institute CPA - C++ Certified Associate Programmer (CPA-21-02) Exam effectively. You are welcome to explore sample free C++ Institute CPA-21-02 Exam questions below and also try C++ Institute CPA-21-02 Exam practice test software.
Do you know that you can access more real C++ Institute CPA-21-02 exam questions via Premium Access? ()
What will happen when you attempt to compile and run the following code?
#include
using namespace std;
int main (int argc, const char * argv[])
{
enum state { ok, error, warning};
enum state s1, s2, s3;
s1 = ok;
s2 = warning;
s3 = error;
s4 = ok;
cout << s1<< s2<< s3;
return 0;
}
Answer : B
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
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
Which code line instead of the comment below will cause the program to produce the expected output?

Answer : C
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