C++ Certified Associate Programmer (CPA) - CPPL

Exam Questions

94%

Students found the real exam almost the same

1,057

Students passed this exam after ExamsQA Prep

95.1%

Average score during Real Exams at the Testing Centre

💡

Browse at least 50% questions to maximize your chances of passing

Free Preview Questions

Sample CPA Exam Questions & Explanations

Practice with real question formats, multiple choice options, and detailed answer explanations for CPPL CPA.

Question #1 Verified Q&A
What will the variable "age" be in class B?<br />
class A {<br />
int x;<br />
protected:<br />
int y;<br />
public:<br />
int age;<br />
A () { age=5; };<br />
};<br />
class B : public A {<br />
string name;<br />
public:<br />
B () { name="Bob"; };<br />
void Print() {<br />
cout << name << age;<br />
}<br />
};
A None of these
B protected
C public
D private
Correct Answer: public
Question #2 Verified Q&A
What happens when you attempt to compile and run the following code? #include <iostream> #include <string><br />
using namespace std;<br />
class complex{<br />
double re, im;<br />
public:<br />
complex() : re(1),im(0.4) {}<br />
complex operator?(complex &t);<br />
void Print() { cout << re << " " << im; }<br />
};<br />
complex complex::operator? (complex &t){<br />
complex temp;<br />
temp.re = this?>re ? t.re;<br />
temp.im = this?>im ? t.im;<br />
return temp;<br />
}<br />
int main(){<br />
complex c1,c2,c3;<br />
c3 = c1 ? c2;<br />
c3.Print();<br />
}
A It prints: 1 0.8
B It prints: 2 0.8
C It prints: 1 0.4
D It prints: 0 0
Correct Answer: It prints: 0 0
Question #3 Verified Q&A
What happens when you attempt to compile and run the following code? #include <iostream><br />
using namespace std;<br />
class complex{<br />
double re;<br />
double im;<br />
public:<br />
complex() : re(0),im(0) {}<br />
complex(double<br />
<br />
x) { re=x,im=x;};<br />
complex(double x,double<br />
<br />
y) { re=x,im=y;}<br />
void print() { cout << re << " " << im;}<br />
};<br />
int main(){<br />
complex c1;<br />
c1 = 3.0;<br />
c1.print();<br />
return 0;<br />
}
A Compilation error
B It prints: 1 1
C It prints: 0 0
D It prints: 3 3
Correct Answer: It prints: 3 3
Question #4 Verified Q&A
What happens when you attempt to compile and run the following code? #include <iostream><br />
using namespace std;<br />
void fun(int);<br />
int main()<br />
{<br />
int a=0;<br />
fun(a);<br />
return 0;<br />
}<br />
void fun(int n)<br />
{<br />
if(n < 2)<br />
{<br />
fun(++n);<br />
cout << n;<br />
}<br />
}
A None of these
B It prints: 012
C It prints: 21
D It prints: 0
Correct Answer: It prints: 21
Question #5 Verified Q&A
What happens when you attempt to compile and run the following code? #include <iostream><br />
using namespace std;<br />
int s(int n);<br />
int main()<br />
{<br />
int a;<br />
a = 3;<br />
cout << s(a);<br />
return 0;<br />
}<br />
int s(int n)<br />
{<br />
if(n == 0) return 1;<br />
return s(n?1)*n;<br />
}
A It prints: 0
B It prints: 6
C It prints: 4
D It prints: 3
Correct Answer: It prints: 6

Want to practice all 220 questions?

Practice under real exam conditions with instant grading, timed simulations, and community insights.

Start Full CPA Practice Test

Frequently Asked Questions

Common questions about the CPPL CPA certification practice test

How many questions are in the CPPL CPA practice exam on ExamsQA?
Our CPA (C++ Certified Associate Programmer) practice question bank currently includes 220 verified questions with comprehensive explanations.
Are the CPA exam practice questions up to date for 2026?
Yes, all CPPL CPA practice questions are regularly updated and verified against current exam objectives.
Will the CPA practice questions help me pass on my first attempt?
The CPA (C++ Certified Associate Programmer) question bank is built to mirror the real exam's format and topics, with detailed explanations for every answer so you understand the reasoning — not just memorize responses.
Is there a free demo available for CPA C++ Certified Associate Programmer?
Yes, ExamsQA offers free demo questions for the CPA exam so you can test the interface and question quality before purchasing full access.