Free CPA-21-02 Mock Exam – Practice Online Confidently

Increase your chances of passing the C++ Institute CPA-21-02 exam questions on your first try. Practice with our free online CPA-21-02 exam mock test designed to help you prepare effectively and confidently.

Exam Code: CPA-21-02
Exam Questions: 257
CPA C++ Certified Associate Programmer
Updated: 04 Jan, 2026
Question 1

What happens if characters 'w', 'o', 'r', 'l' and 'd' are entered as input? #include #include using namespace std; int main() { string s1 = "Hello"; string s2; getline( cin, s2 ); cout << s1 + s2; return( 0 ); } 

Options :
Answer: A

Question 2

What happens when you attempt to compile and run the following code? #include using namespace std; class Test { float i,j; }; class Add { public: int x,y; Add (int a=3, int b=3) { x=a; y=b; } int result() { return x+y;} }; int main () { Test test; Add * padd; padd = &test; cout << padd?>result(); return 0; }

Options :
Answer: C

Question 3

What will be the output of the program? #include using namespace std; int fun(int); int main() { cout << fun(5); return 0; } int fun(int i) { return i*i; }

Options :
Answer: A

Question 4

Which of the following expressions decrement variable i by 2? (Choose two.) 

Options :
Answer: B,C

Question 5

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


Options :
Answer: C

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

© Copyrights FreeMockExams 2026. All Rights Reserved

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