Last Update 17 hours ago Total Questions : 257
The CPA - C++ Certified Associate Programmer content is now fully updated, with all current exam questions added 17 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 of the following is a logical operator?
What will be the output of the program?
#include < iostream >
#include < string >
using namespace std;
int fun(int);
int main()
{
float k=3;
k = fun(k);
cout < < k;
return 0;
}
int fun(int i)
{
i++;
return i;
}
What happens when you attempt to compile and run the following code?
#include < iostream >
#include < string >
using namespace std;
class A {
public:
int x;
A() { x=0;}
};
class B {
public:
int x;
B() { x=1;}
};
class C :public A, public B {
public:
int x;
C(int x) {
this? > x = x;
What happens when you attempt to compile and run the following code?
#include < iostream >
#include < string >
using namespace std;
class A {
int x;
protected:
int y;
public:
int z;
};
class B : public A {
string name;
public:
void set() {
y = 2;
z = 3;
}
void Print() { cout < < y < < z; }
};
int main () {
B b;
b.set();
b.Print();
return 0;
}
What will be the output of the program?
#include < iostream >
using namespace std;
int fun(int);
int main()
{
cout < < fun(5);
return 0;
}
int fun(int i)
{
return i*i;
}
What happens when you attempt to compile and run the following code?
#include < cstdlib >
#include < iostream >
using namespace std;
inline float sum(float a,float b)
{
return a+b;
}
int main()
{
float a,b;
a = 1.5; b = 3.4;
cout < < sum(a,b);
return 0;
}
What happens when you attempt to compile and run the following code?
#include < iostream >
using namespace std;
namespace myNamespace1
{
int x = 5;
int y = 10;
}
namespace myNamespace2
{
float x = 3.14;
float y = 1.5;
}
int main () {
{
using namespace myNamespace1;
cout < < x < < " " ;
}{
using namespace myNamespace2;
cout < < y;
}
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 x,y;
union t
{
char tab[2];
int i;
};
union t u;
u.tab[0] = 1;
u.tab[1] = 2;
u.i = 0;
x = u.tab[0];
y = u.tab[1];
cout < < x < < " , " < < y < < " , " < < u.i;
return 0;
}
What happens when you attempt to compile and run the following code?
#include < iostream >
using namespace std;
int fun(int x) {
return x < < 2;
}
int main(){
int i;
i = fun(1) / 2;
cout < < i;
return 0;
}
What happens when you attempt to compile and run the following code?
#include < iostream >
using namespace std;
class complex{
double re;
double im;
public:
complex() : re(0),im(0) {}
complex(double x) { re=x,im=x;};
complex(double x,double y) { re=x,im=y;}
void print() { cout < < re < < " " < < im;}
};
int main(){
complex c1;
double i=2;
c1 = i;
c1.print();
return 0;
}
