Important C++ Institute CPA-21-02 Exam Questions

CertPrep C++ Institute CPA-21-02 Exam Questions
Get Full Version

C++ Institute CPA - C++ Certified Associate Programmer Exam CPA-21-02 Exam

Attempt the C++ Certified Associate Programmer practice test and solve real exam-like CPA-21-02 questions to prepare efficiently and increase your chances of success. Our C++ Institute CPA-21-02 practice questions match the actual CPA - C++ Certified Associate Programmer Exam format, helping you enhance confidence and improve performance. With our CPA-21-02 practice exam software, you can analyze your performance, identify weak areas, and work on them effectively to boost your final C++ Certified Associate Programmer exam score.

Vendor: C++ Institute
Exam Name: CPA - C++ Certified Associate Programmer Exam
Registration Code: CPA-21-02
Related Certification: C++ Institute CPA Programmer Certification
Exam Track: C++ Institute Development
Exam Audience:

Total Questions

257

Last Updated

14-07-2026

Exam Duration

65 MINUTES

Upgrade to Premium

GET FULL PDF

Question: 1

What happens when you attempt to compile and run the following code?

#include

using namespace std;

struct {

int x;

char c;

union {

float f;

int i;

};

} s;

int main (int argc, const char * argv[])

{

s.x=10;

s.i=0;

cout << s.i << " " << s.x;

}

Question: 2

What happens when you attempt to compile and run the following code?

#include

using namespace std;

#define FUN(arg) if(arg) cout<<"Test";

int main()

{

int i=1;

FUN(i<3);

return 0;

}

Question: 3

What is the output of the program if character ''1'' is supplied as input?

#include

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;

}

Question: 4

What happens when you attempt to compile and run the following code?

#include

using namespace std;

class BaseClass

{

public:

int *ptr;

BaseClass(int i) { ptr = new int(i); }

~BaseClass() { delete ptr; delete ptr;}

void Print() { cout << *ptr; }

};

void fun(BaseClass x);

int main()

{

BaseClass o(10);

fun(o);

o.Print();

}

void fun(BaseClass x) {

cout << "Hello:";

}

Question: 5

What happens when you attempt to compile and run the following code?

#include

#include

using namespace std;

class A {

int x;

protected:

int y;

public:

int z;

A() { x=1; y=2; z=3; }

};

class B : public A {

string z;

public:

void set() {

y = 4;

z = "John";

}

void Print() {

cout << y << z;

}

};

int main () {

B b;

b.set();

b.Print();

return 0;

}

Other C++ Institute Certification Exams

CPP Exam

CPP - C++ Certified Professional Programmer Exam