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 happens when you attempt to compile and run the following code?
#include < iostream >
using namespace std;
void set(struct person*);
struct person
{
int age;
};
int main()
{
struct person e = {18};
set( & e);
cout < < e.age;
return 0;
}
void set(struct person *p)
{
p? > age = p? > age + 1;
}
What is the output of the program?
#include < iostream >
#include < string >
using namespace std;
int main()
{
string s1= " Hello " ;
string s2= " World " ;
s1+=s2;
cout < < s1;
return( 0 );
}
What is the output of the program?
#include < iostream >
#include < string >
using namespace std;
int main()
{
string s1[]= { " Hello " , " World " };
for (int i=0; i < 2; i++) {
cout < < s1[i];
}
return( 0 );
}
What happens when you attempt to compile and run the following code?
#include < iostream >
using namespace std;
void fun(int);
int main()
{
int a=0;
fun(a);
return 0;
}
void fun(int n)
{
if(n < 2)
{
fun(++n);
cout < < n;
}
}
What is the output of the program given below?
#include < iostream >
using namespace std;
int main (int argc, const char * argv[])
{
int i=10;
{
int i=0;
cout < < i;
}
{
int i=5;
cout < < i;
}
cout < < i;
return 0;
}
What happens when you attempt to compile and run the following code?
#include < iostream >
#include < string >
using namespace std;
class A {
public:
string s;
A(string s) { this? > s = s; }
};
class B {
public:
string s;
B (A a) { this? > s = a.s; }
void print() { cout < < s; }
};
int main()
{
A a( " Hello world " );
B b=a;
b.print();
}
What happens when you attempt to compile and run the following code?
#include < iostream >
#include < string >
using namespace std;
class A {
protected:
int y;
public:
int x;
int z;
A() { x=2; y=2; z=3; }
A(int a, int b) : x(a), y(b) { z = x ? y;}
void Print() {
cout < < z;
}
};
int main () {
A a(2,5);
a.Print();
return 0;
}
What is the output of the program?
#include < iostream >
using namespace std;
class Base {
static int age;
public:
Base () {};
~Base () {};
void setAge(int a=10) {age = a;}
void Print() { cout < < age;}
};
int Base::age=0;
int main () {
Base a,*b;
b = new Base();
a.setAge();
b? > setAge(20);
a.Print();
b? > Print();
return 0;
}
How many times will the program print " HELLO " ?
#include < iostream >
using namespace std;
int main()
{
cout < < " HELLO " ;
main();
return 0;
}
What happens when you attempt to compile and run the following code?
#include < iostream >
using namespace std;
int f(int a, int b);
int main()
{
float b;
b = f(20,10);
cout < < b;
return 0;
}
int f(int a, int b)
{
return a/b;
}
