CPA-21-02 Exam Preparation Material | CPA – C++ Certified Associate Programmer

Prepare for the CPA-21-02 with reliable study materials, practice questions, and key exam insights.

Prepare for the CPA-21-02 CPA – C++ Certified Associate Programmer exam with CertQueen's independently developed study resources. Review important concepts, practice scenario-based questions, and use clear explanations to identify areas that require further study.

Question#1

What happens when you attempt to compile and run the following code?
#include <iostream>
#include <sstream>
#include <string>
using namespace std;
int main(void)
{
string s;
s = "Test";
s.resize (s.size() ? 1);
cout<<s<<" "<<s.size();
return 0;
}

A. It prints: Test 4
B. It prints: Test 3
C. Compilation error
D. It prints: Tes 3

Question#2

What happens when you attempt to compile and run the following code?
#include <iostream>
using namespace std;
class First
{
public:
void Print(){ cout<<"from First";}
};
class Second:public First
{
public:
void Print(){ cout<< "from Second";}
};
void fun(First *obj);
int main()
{
First FirstObject;
fun(&FirstObject);
Second SecondObject;
fun(&SecondObject);
}
void fun(First *obj)
{
obj?>Print();
}

A. It prints: from First
B. It prints: from Firstfrom First
C. It prints: from Firstfrom Second
D. It prints: from Secondfrom Second

Question#3

Analyze the code below. If it contains an error, indicate its place in the program.


A. Error in the for loop
B. Error in the break statement
C. No error
D. Error in the if statement

Question#4

What happens when you attempt to compile and run the following code?
#include <iostream>
using namespace std;
class A {
public:
virtual void Print()=0;
};
class B: public A {
public:
virtual void Print() { cout<< "B"; }
};
class C: public A {
public:
virtual void Print() { cout<< "C"; }
};
int main()
{
Bob2;
Cob3;
A*obj;
obj = &ob2;
obj?>Print();
obj = &ob3;
obj?>Print();
}

A. It prints: BC
B. It prints: CB
C. It prints: CC
D. It prints: BB

Question#5

What will be the output of the program?
#include <iostream>
#include <string>
using namespace std;
int fun(int);
int main()
{
float k=3;
k = fun(k);
cout<<k;
return 0;
}
int fun(int i)
{
i++;
return i;
}

A. 3
B. 5
C. 4
D. 5

Exam Code: CPA-21-02
Q & A: 257 Q&As         Updated:  Oct 07,2026

 

 Access Complete CPA-21-02 Preparation Material

What This CPA-21-02 Study Resource Helps You Do

Review Key Concepts

Review the technologies, products, processes, and practical skills covered by the current CPA-21-02 exam objectives.

Practice Scenario-Based Questions

Work through independently developed questions designed to strengthen your understanding of technical scenarios and decision-making.

Identify Knowledge Gaps

Use your results and the provided explanations to find weaker areas and focus your study more effectively.

How to Use This CPA-21-02 Preparation Material

Review the Exam Scope

Start by reviewing the topics covered by the CPA-21-02 exam. Compare them with the official exam objectives to understand the required technologies, operational tasks, and practical skills, then identify the areas that deserve the most attention.

Practice Independently

Complete a focused set of practice questions for each topic. On your first attempt, avoid referring to notes, answers, or other study resources so that you can evaluate your current understanding more accurately.

Study the Explanations

Review the answers and explanations after completing each practice session. Understand why the correct option is appropriate for the given scenario and why the other options may be incorrect or less suitable.

Close Knowledge Gaps

Keep track of incorrect answers, unfamiliar concepts, and weaker knowledge areas. Review these topics using official documentation and practical experience, then answer the related questions again to reinforce your understanding and monitor your progress.

Independent CPA-21-02 Preparation Resource

CertQueen independently develops its certification study materials for educational purposes. The practice questions are not copied from, recalled from, or presented as live or official exam questions.

CertQueen is not affiliated with, endorsed by, sponsored by, or authorized by any certification provider. Certification names, exam codes, product names, and related trademarks are the property of their respective owners and are referenced only for identification and educational purposes.

Exam Code: CPA-21-02
Q & A: 257 Q&As
Updated:  Oct 07,2026

 

 Access Complete CPA-21-02 Preparation Material