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.
Which code line instead of the comment below will cause the program to produce the expected output?

What happens when you attempt to compile and run the following code?
#include < iostream >
using namespace std;
class Base {
int age;
public:
class C {
int b;
void PrintC() { cout < < b; }
};
Base () {age=5;};
void setAge(int a=20) {age = a;}
void Print() { cout < < age;}
};
int main () {
Base a;
a.setAge(10);
a.Print();
return 0;
}
Which definitions are correct?
What happens when you attempt to compile and run the following code?
#include < iostream >
using namespace std;
int main()
{
int *a= new int;
*a=100;
cout < < *a;
delete a;
}
What happens when you attempt to compile and run the following code?
#include < iostream >
using namespace std;
int main()
{
int i = 0;
do {
i++;
if (i==3)
break;
cout < < i;
}
while(i < 5);
return 0;
}
What happens when you attempt to compile and run the following code?
#include < iostream >
using namespace std;
#define DEF_A 0
#define DEF_B DEF_A+1
#define DEF_C DEF_B+1
int main(int argc, char *argv[]) {
cout < < DEF_C;
return 0;
}
What happens when you attempt to compile and run the following code?
#include < iostream >
using namespace std;
int main (int argc, const char * argv[])
{
int a = 30, b = 1, c = 5, i=10;
i = b < a < c;
cout < < i;
return 0;
}
What will the variable " age " be in class B?
class A {
int x;
protected:
int y;
public:
int age;
A () { age=5; };
};
class B : public A {
string name;
public:
B () { name= " Bob " ; };
void Print() {
cout < < name < < age;
}
};
What happens when you attempt to compile and run the following code?
#include < iostream >
using namespace std;
int s(int n);
int main()
{
int a;
a = 3;
cout < < s(a);
return 0;
}
int s(int n)
{
if(n == 0) return 1;
return s(n?1)*n;
}
What will the variable " age " be in class B?
class A {
int x;
protected:
int y;
public:
int age;
};
class B : protected A {
string name;
public:
void Print() {
cout < < name < < age;
}
};
