Limited-Time Offer: Enjoy 50% Savings! - Ends In 0d 00h 00m 00s Coupon code: 50OFF
Welcome to QA4Exam

Exam preparation

C++ Institute CPA-21-02 Exam Guide for the C++ Certified Associate Programmer

CPA-21-02 is the C++ Institute CPA - C++ Certified Associate Programmer Exam, part of the C++ Certified Associate Programmer certification. You get 40 questions and 65 minutes. The official outline has 8 exam topics. For your exam preparation, each topic below links to its own free practice questions. 10 are online now, with answers and explanations.

CPA-21-02 Exam Details

Exam Code
CPA-21-02
Real Exam Questions
40
Time Limit
65 min
Free Practice Questions
10
Full Question Set
257
Exam Topics
8
Last Updated
December 4, 2026
Exam Name
CPA - C++ Certified Associate Programmer Exam
Question Types
MCQs
Certification
C++ Certified Associate Programmer
Certification Track
C++ Institute Development
Technology
Programming Language

CPA-21-02 Exam Topics and Weights

Absolute Basics

What this topic covers

Write simple C++ programs and explain how source code becomes machine code through compilation. Work with integer and character values, variables, operators, and basic input and output using standard streams.

What is the difference between std::cin and std::cout?

std::cin is the standard input stream that reads values from the keyboard, while std::cout is the standard output stream that writes text to the console. Use the extraction operator >> with cin and the insertion operator > age reads an integer into age, and std::cout

1 free CPA-21-02 practice question on Absolute Basics

Flow Control and More Data Types

What this topic covers

Control program execution with conditions and loops, including ways to change loop behavior. Use floating-point and integer types with arithmetic, logical, and bitwise operators.

How does n & 1 show whether an integer n is odd?

The expression n & 1 keeps only the lowest bit of n, which is 1 exactly when n is odd. For example, 7 & 1 gives 1 because 7 is binary 111, while 6 & 1 gives 0 because 6 is binary 110. Comparing the result with 1 gives a true or false test.

1 free CPA-21-02 practice question on Flow Control and More Data Types

Functions

What this topic covers

Declare and call functions, and choose how parameters are passed, including by const reference to avoid copying and prevent changes. Use default parameters, inline functions, and overloads to support different argument types.

How do overloaded functions differ from functions with default parameters?

Overloaded functions share a name but have different parameter lists, and the compiler picks one by the argument types. Default parameters let one function be called with fewer arguments, using preset values for the rest. For example, charge(int) and charge(double) are overloads, while charge(double amount, int fee = 0) uses a default.

2 free CPA-21-02 practice questions on Functions

Accessing Data and Dealing with Exceptions

What this topic covers

Convert values between types and work with strings as objects, including methods such as size. Use namespaces and handle conversion failures and other exceptions.

Which exception does std::stoi throw for text like abc, and which for a huge number?

std::stoi throws std::invalid_argument when the text cannot be converted at all, such as abc. It throws std::out_of_range when the number is valid but too large to fit in an int. Catch both in separate handlers, or catch their base class std::exception to handle either one.

2 free CPA-21-02 practice questions on Accessing Data and Dealing with Exceptions

Fundamentals of the Object-Oriented Approach

What this topic covers

Build classes and create objects using constructors, member functions, and static members shared across instances. Refer to objects, use friends, and define or overload operators.

Why does a static data member keep one shared value for all objects?

A static data member belongs to the class itself, not to each object, so there is only one copy. Every object of the class reads and updates that same variable. For example, a static counter incremented in each constructor counts how many objects exist, and it must be defined outside the class.

1 free CPA-21-02 practice question on Fundamentals of the Object-Oriented Approach

Class Hierarchy

What this topic covers

Create class hierarchies with base and derived classes, and understand how inheritance affects public and protected members. Use different inheritance forms, including multiple inheritance.

After public inheritance, what happens to protected members of the base class in the derived class?

They remain protected in the derived class, so derived class member functions can use them but outside code cannot. Public base members stay public, and private base members are not directly accessible from the derived class. For example, a protected int in Shape can be read inside Circle but not from main.

1 free CPA-21-02 practice question on Class Hierarchy

More on Classes

What this topic covers

Use polymorphism to call derived-class behavior through a base-class interface. Declare and inherit virtual methods, and use pure virtual methods to define abstract classes.

What does a pure virtual function make a class, and what does it allow?

A pure virtual function, declared with = 0, makes its class abstract, so you cannot create objects of that class. Derived classes override it, and calling it through a base pointer runs the override in the object's actual type. For example, a virtual double cost() const = 0 in Equipment forces each subtype to supply its own cost.

1 free CPA-21-02 practice question on More on Classes

The Basics of Functions

What this topic covers

Throw and catch exceptions to report and handle failures, including with standard exception types. Understand exception class hierarchies and define custom exceptions for program-specific errors.

Why throw std::runtime_error instead of returning a sentinel value like -1 on failure?

Throwing std::runtime_error reports the failure directly, so a fake result like -1 cannot be mistaken for valid data. The caller catches it with a catch block whose type matches or is a base of runtime_error, such as std::exception. Control then jumps out of the failing function.

1 free CPA-21-02 practice question on The Basics of Functions

Related Exams

Continue to Free CPA-21-02 Exam Questions