C++ Institute CPA-21-02 Exam (page: 1)
C++ Institute CPA - C++ Certified Associate Programmer
Updated on: 28-Jul-2025

Viewing Page 1 of 53

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;
}
};

  1. public
  2. private
  3. protected
  4. None of these

Answer(s): A



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();
}

  1. It prints: 1 0.4
  2. It prints: 2 0.8
  3. It prints: 0 0
  4. It prints: 1 0.8

Answer(s): C



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;
}

  1. It prints: 0 0
  2. It prints: 1 1
  3. It prints: 3 3
  4. Compilation error

Answer(s): C



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;
}
}

  1. It prints: 21
  2. It prints: 012
  3. It prints: 0
  4. None of these

Answer(s): A



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;
}

  1. It prints: 4
  2. It prints: 6
  3. It prints: 3
  4. It prints: 0

Answer(s): B



Viewing Page 1 of 53



Share your comments for C++ Institute CPA-21-02 exam with other users:

Muhammad Rawish Siddiqui 12/5/2023 12:38:00 PM

question # 142: data governance is not one of the deliverables in the document and content management context diagram.
SAUDI ARABIA


al 6/7/2023 10:25:00 AM

most answers not correct here
Anonymous


Bano 1/19/2024 2:29:00 AM

what % of questions do we get in the real exam?
UNITED STATES


Oliviajames 10/25/2023 5:31:00 AM

i just want to tell you. i took my microsoft az-104 exam and passed it. your program was awesome. i especially liked your detailed questions and answers and practice tests that made me well-prepared for the exam. thanks to this website!!!
UNITED STATES


Divya 8/27/2023 12:31:00 PM

all the best
UNITED STATES


KY 1/1/2024 11:01:00 PM

very usefull document
Anonymous


Arun 9/20/2023 4:52:00 PM

nice and helpful questions
INDIA


Joseph J 7/11/2023 2:53:00 PM

i found the questions helpful
UNITED STATES


Meg 10/12/2023 8:02:00 AM

q 105 . ans is d
INDIA


Navaneeth S 7/14/2023 7:57:00 AM

i have interest to get a sybase iq dba certification
UNITED STATES


Aish 10/11/2023 5:27:00 AM

want to pass exm.
INDIA


Anonymous 6/12/2023 7:23:00 AM

are the answers correct?
INDIA


Kris 7/7/2023 9:43:00 AM

good morning, could you please upload this exam again, i need it to test my knowledge in sd-wan with version 7.0.
Anonymous


Meghraj mali 10/7/2023 1:47:00 PM

very nice question
CANADA


Noel 11/1/2022 9:14:00 PM

i have learning disability and this exam dumps allowed me to focus on the actual questions and not worry about notes and the those other study materials.
SOUTH AFRICA


Jas 10/25/2023 6:01:00 PM

165 should be apt
UNITED STATES


Neetu 6/22/2023 8:41:00 AM

please upload the dumps, real need of them
Anonymous


Mark 10/24/2023 1:34:00 AM

any recent feeedback?
UNITED STATES


Gopinadh 8/9/2023 4:05:00 AM

question number 2 is indicating you are giving proper questions. observe and change properly.
Anonymous


Santhi 1/1/2024 8:23:00 AM

passed today.40% questions were new.litwere case study,lots of new questions on afd,ratelimit,tm,lb,app gatway.got 2 set series of questions which are not present here.questions on azure cyclecloud, no.of vnet/vms required for implimentation,blueprints assignment/management group etc
INDIA


Raviraj Magadum 1/12/2024 11:39:00 AM

practice test
INDIA


sivaramakrishnan 7/27/2023 8:12:00 AM

want the dumps for emc content management server programming(cmsp)
Anonymous


Aderonke 10/23/2023 1:52:00 PM

brilliant and helpful
UNITED KINGDOM


Az 9/16/2023 2:43:00 PM

q75. azure files is pass
SWITZERLAND


ketty 11/9/2023 8:10:00 AM

very helpful
Anonymous


Sonail 5/2/2022 1:36:00 PM

thank you for these questions. it helped a lot.
UNITED STATES


Shariq 7/28/2023 8:00:00 AM

how do i get the h12-724 dumps
Anonymous


adi 10/30/2023 11:51:00 PM

nice data dumps
Anonymous


EDITH NCUBE 7/25/2023 7:28:00 AM

answers are correct
SOUTH AFRICA


Raja 6/20/2023 4:38:00 AM

good explanation
UNITED STATES


BigMouthDog 1/22/2022 8:17:00 PM

hi team just want to know if there is any update version of the exam 350-401
AUSTRALIA


francesco 10/30/2023 11:08:00 AM

helpful on 2017 scrum guide
EUROPEAN UNION


Amitabha Roy 10/5/2023 3:16:00 AM

planning to attempt for the exam.
Anonymous


Prem Yadav 7/29/2023 6:20:00 AM

pleaseee upload
INDIA