C++ Institute CPA-21-02 Practice Exam Questions & Answers
C++ Institute CPA-21-02 Exam Details
Key details for this exam, checked against the published exam outline
- Exam Code
- CPA-21-02
- Full Name
- CPA - C++ Certified Associate Programmer Exam
- Issuing Body
- C++ Institute
- Question Format (Our Bank)
- Multiple Choice
- Official Exam Fee
- USD 325. USD 375 (Exam + Retake)
- Delivery
- Pearson VUE Test Center or Pearson VUE OnVUE Online Proctoring
- Full Question Set
- 257 questions Get All Questions
Free CPA-21-02 Practice Questions
Each question shows the correct answer and an explanation of why it is right
Question 1 Domain 2 Flow Control and More Data Types
What is the outcome when the following code is compiled and executed?

Question 2 Domain 2 Flow Control and More Data Types
Consider the program below. What is the result of compiling and running it?
#include
using namespace std;
class A {
public :
void print() {
cout << "A ";
}
};
class B {
public :
void print() {
cout << "B ";
}
};
int main() {
B sc[2];
B *bc = (B*)sc;
for (int i=0; i<2;i++)
(bc++)->print();
return 0;
}
Question 3 Domain 4 Accessing Data and Dealing with Exceptions
Consider the program below. What is the outcome when it is compiled and executed?
#include
#include
using namespace std;
class A {
public:
A() { cout << "A no parameters";}
A(string s) { cout << "A string parameter";}
A(A &a) { cout << "A object A parameter";}
};
class B : public A {
public:
B() { cout << "B no parameters";}
B(string s) { cout << "B string parameter";}
B(int s) { cout << "B int parameter";}
};
int main () {
A a2("Test");
B b1(10);
B b2(b1);
return 0;
}
Get the complete CPA-21-02 question set
$20$40
Question 4 Domain 6 Class Hierarchy
What is the outcome of compiling and running the program shown below?
#include
using namespace std;
int main()
{
int i = 0;
do {
i++;
if (i==3)
break;
cout<
}
while(i < 5);
return 0;
}
Question 5 Domain 4 Accessing Data and Dealing with Exceptions
Which output does the following program generate?
#include
#include
using namespace std;
int main()
{
string s1="World";
string s2;
s2="Hello" + s1;
cout << s2;
return( 0 );
}
Question 6 Domain 1 Absolute Basics
Consider the program below. What is the outcome when it is compiled and executed?
#include
using namespace std;
int x=5;
static int y;
int i=0;
void static myFunction()
{
y=x++ + ++i;
}
int main (int argc, const char * argv[])
{
x++;
myFunction();
cout< }
Question 7 Domain 3 Functions
Which statement must be inserted into the program below so that it operates properly?
using namespace std;
int main (int argc, const char * argv[])
{
cout<<"Hello";
}
Question 8 Domain 5 Fundamentals of the Object-Oriented Approach
Examine the code shown below. If it includes a mistake, specify where it occurs in the program.

What the C++ Institute CPA-21-02 Exam Covers
Exam domains verified against the Official C++ Institute CPA-21-02 exam guide, last checked November 2026.
Domain 1 Absolute Basics
Covers foundational programming concepts including machine and high-level languages, compilation, variables, integers, characters, streams and basic input/output. This is where you learn to write your first working programs and understand how code becomes machine executable.
Sample question from this domain above Q6
Domain 2 Flow Control and More Data Types
Explores program flow control, floating point and additional integer types, loops, and operators including logic, bitwise and arithmetic operations. Mastering these allows you to write programs that make decisions and repeat actions based on conditions.
Domain 3 Functions
Focuses on function declaration, invocation, parameters, default parameters, inline functions and overloaded functions. Functions let you break large programs into manageable reusable pieces and are essential to writing maintainable code.
Sample question from this domain above Q7
Domain 4 Accessing Data and Dealing with Exceptions
Covers type conversion, strings as objects with methods and properties, namespaces, and exception handling. Understanding exceptions helps you write robust code that handles errors gracefully rather than crashing.
Domain 5 Fundamentals of the Object-Oriented Approach
Introduces classes, objects, constructors, static members, friend classes and operator overloading. Object-oriented programming organizes code around data and the operations that work on that data, making large projects easier to manage.
Sample question from this domain above Q8
Domain 6 Class Hierarchy
Explores inheritance, base classes, subclasses, types of inheritance and multiple inheritance. Inheritance lets you create new classes based on existing ones, avoiding code duplication and building organized hierarchies of related types.
Sample question from this domain above Q4
Domain 7 More on Classes
Delves into polymorphism, virtual methods, abstract classes and abstraction. These advanced class concepts allow objects of different types to behave differently while using the same interface, enabling flexible and extensible designs.
Domain 8 The Basics of Functions
Focuses on exceptions in programming, covering what exceptions are, how to catch and throw them, exception class hierarchies and defining custom exceptions. This topic teaches defensive programming practices that keep applications stable when unexpected situations occur.
CPA-21-02 Exam FAQ
Common questions about the exam itself
What prior experience do I need before taking the CPA-21-02 exam?
How hard is the CPA-21-02 exam and what makes it challenging?
How long should I spend studying for CPA-21-02?
Can I retake CPA-21-02 if I fail?
What happens on exam day when I take CPA-21-02?
How much does the CPA-21-02 exam cost?
What format are the CPA-21-02 questions?
How does CPA-21-02 relate to other C++ Institute exams?
How long is the CPA-21-02 certification valid for?
What job roles benefit from having the CPA-21-02 certification?
Other C++ Institute Exams
Free practice questions for more C++ Institute certification exams
