Last Update 19 hours ago Total Questions : 257
The CPA - C++ Certified Associate Programmer content is now fully updated, with all current exam questions added 19 hours ago. Deciding to include CPA-21-02 practice exam questions in your study plan goes far beyond basic test preparation.
You'll find that our CPA-21-02 exam questions frequently feature detailed scenarios and practical problem-solving exercises that directly mirror industry challenges. Engaging with these CPA-21-02 sample sets allows you to effectively manage your time and pace yourself, giving you the ability to finish any CPA - C++ Certified Associate Programmer practice test comfortably within the allotted time.
What is the output of the program?
#include < iostream >
#include < string >
using namespace std;
union t
{
char c;
int i;
};
class First
{
union t u;
public:
First() {
u.c = ' A ' ;
}
void Print(){
cout < < u.c;
}
};
int main()
{
First *t = new First();
t? > Print();
}
What is the output of the program if character “1” is supplied as input?
#include < iostream >
using namespace std;
int main () {
int c;
cin > > c;
try
{
switch (c)
{
case 1:
throw 20;
case 2:
throw 5.2f;
case 3:
throw ' a ' ;
}
}
catch (int e)
{ cout < < " int exception. Exception Nr. " < < e; }
catch (float e)
{ cout < < " float exception. Exception Nr. " < < e; }
catch (...)
{ cout < < " An exception occurred. " ; }
return 0;
}
Which code line inserted instead of the comment below will cause the program to produce the expected output?

What is the output of the program?
#include < iostream >
using namespace std;
#define SQR(x)(x*x)
int main(int argc, char *argv[]) {
int x, y=2;
x = SQR(y);
cout < < x < < " , " < < y;
return 0;
}
What is not inherited from the base class?
What happens when you attempt to compile and run the following code?
#include < iostream >
#include < string >
using namespace std;
int main()
{
string s1[]= { " How " , " to " };
s1[0].swap(s1[1] );
for (int i=0; i < 2; i++) {
cout < < s1[i];
}
return( 0 );
}
What is the output of the program?
#include < iostream >
#include < string >
using namespace std;
int main()
{
string s1= " Wo " ;
string s2;
s2 = s1;
string s3;
s3 = s2.append( " rldHello " );
cout < < s3;
return( 0 );
}
