Last Update 16 hours ago Total Questions : 257
The CPA - C++ Certified Associate Programmer content is now fully updated, with all current exam questions added 16 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 happens when you attempt to compile and run the following code?
#include < iostream >
using namespace std;
int main()
{
union un
{
int x;
char c;
};
union un u1 = {10};
union un u2 = { ' a ' };
union un u3 = {20, ' a ' };
cout < < u1.x;
cout < < u2.c;
cout < < u3.c;
return 0;
}
What happens when you attempt to compile and run the following code?
#include < iostream >
#include < string >
using namespace std;
class A {
public:
A() { cout < < " A0 " ;}
A(string s) { cout < < " A1 " ;}
};
class B : public A {
public:
B() { cout < < " B0 " ;}
B(string s) { cout < < " B1 " ;}
};
class C : private B {
public:
C() { cout < < " C0 " ;}
C(string s) { cout < < " C1 " ;}
};
int main () {
B b1;
C c1;
return 0;
}
What is the output of the program?
#include < iostream >
using namespace std;
int main()
{
int tab[4]={10,20,30,40};
tab[1]=10;
int *p;
p= & tab[0];
cout < < *p;
return 0;
}
What happens when you attempt to compile and run the following code?
#include < iostream >
#include < exception >
using namespace std;
class myClass : public exception
{
virtual const char* what() const throw()
{
return " My exception. " ;
}
} obj;
int main () {
try
{
throw obj;
}
catch (exception & e)
{
cout < < e.what() < < endl;
}
return 0;
}
What is the output of the program?
#include < iostream >
#include < string >
using namespace std;
class First
{
string name;
public:
First() {
name = " Alan " ;
}
void Print(){
cout < < name;
}
};
int main()
{
First ob1,*ob2;
ob2 = new First();
ob1.Print();
ob2? > Print();
}
What is the output of the program?
#include < iostream >
#include < string >
using namespace std;
int main () {
string s1 = " Hello " , s2 = " World " ;
s2 = s1 + s2;
cout < < s2;
return 0;
}
What happens when you attempt to compile and run the following code?
#include < iostream >
using namespace std;
class First
{
public:
First() { cout < < " Constructor " ;}
void Print(){ cout < < " from First " ;}
};
int main()
{
First FirstObject;
FirstObject.Print();
}
