Free C++ Institute CPA-21-02 Exam Practice Questions
-
-
PDF Questions

-
Bundle Pack

-
Online Engine

-
-
Question No 1
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; } };
Question No 2
What happens when you attempt to compile and run the following code? #include <iostream> #include <string> using namespace std; class complex{ double re, im; public: complex() : re(1),im(0.4) {} complex operator?(complex &t); void Print() { cout << re << " " << im; } }; complex complex::operator? (complex &t){ complex temp; temp.re = this?>re ? t.re; temp.im = this?>im ? t.im; return temp; } int main(){ complex c1,c2,c3; c3 = c1 ? c2; c3.Print(); }
Question No 3
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; c1 = 3.0; c1.print(); return 0; }
Question No 4
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; } }
Question No 5
What happens when you attempt to compile and run the following code? #include <iostream> using namespace std; int s(int n); int main() { int a; a = 3; cout << s(a); return 0; } int s(int n) { if(n == 0) return 1; return s(n?1)*n; }
-
Page: 1/52
Total 257 Questions
About This CPA-21-02 Question Bank
This page has 257 free practice questions for the C++ Institute CPA-21-02 (CPA - C++ Certified Associate Programmer Exam) exam, last refreshed on 7th Sep 2026. Answer each question, then reveal the correct choice to check your understanding before deciding whether to unlock the full question bank.
The demo above is a sample of the complete CPA-21-02 question set. The full bank includes the PDF, downloadable practice test, and online exam-engine formats listed above, with free updates included for the duration you choose.
Frequently Asked Questions
How many free CPA-21-02 questions can I try here?
This demo includes a sample from our 257-question CPA-21-02 bank so you can check the format and difficulty before purchasing.
Are these CPA-21-02 questions updated?
Yes, the C++ Institute CPA-21-02 question bank is reviewed and refreshed periodically to reflect current exam objectives.
What formats are available for the full CPA-21-02 question bank?
PDF download, an online practice-test engine, and a combined bundle pack with 3, 6, or 12-month free updates.
Is there a refund if I don't pass?
Yes, purchases include a money-back guarantee — see our refund policy for details.