Exam Code: CPA-21-02
Exam Questions: 257
CPA C++ Certified Associate Programmer
Updated: 19 Feb, 2026
Viewing Page : 1 - 26
Practicing : 1 - 5 of 257 Questions
Question 1

Which code line inserted instead of the comment below will fix the program so that it produces the expected output and does not cause any memory leak? 


Options :
Answer: A

Question 2

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; } };

Options :
Answer: A

Question 3

What happens when you attempt to compile and run the following code? #include using namespace std; class BaseC { public: int *ptr; BaseC() { ptr = new int(10);} BaseC(int i) { ptr = new int(i); } ~BaseC() { delete ptr; } }; void fun(BaseC x); int main() { BaseC *o = new BaseC(5); fun(*o); } void fun(BaseC x) { cout << "Hello:"<<*x.ptr; }

Options :
Answer: C

Question 4

Which statement should be added in the following program to make work it correctly? using namespace std; int main (int argc, const char * argv[]) { cout<<"Hello"; }

Options :
Answer: C

Question 5

What happens when you attempt to compile and run the following code? #include #include using namespace std; class A { public: int x; A() { x=0;} A(int x) { this?>x=x;} }; class B : private A { public: using A::x; B() { x=1;} B(int x) {this?>x = x;} }; int main () { B c1; B c2(?5); cout << c1.x; cout << c2.x; return 0; }

Options :
Answer: B

Viewing Page : 1 - 26
Practicing : 1 - 5 of 257 Questions

© Copyrights FreePDFQuestions 2026. All Rights Reserved

We use cookies to ensure that we give you the best experience on our website (FreePDFQuestions). If you continue without changing your settings, we'll assume that you are happy to receive all cookies on the FreePDFQuestions.