CPA-21-02 Exam Details

  • Exam Code
    :CPA-21-02
  • Exam Name
    :CPA - C++ Certified Associate Programmer
  • Certification
    :C++ Institute Certifications
  • Vendor
    :C++ Institute
  • Total Questions
    :257 Q&As
  • Last Updated
    :May 30, 2026

C++ Institute CPA-21-02 Online Questions & Answers

  • Question 181:

    What happens when you attempt to compile and run the following code?

    #include

    using namespace std;

    int fun(int x);

    int main() {

    cout << fun(0);

    }

    int fun(int x) {

    if(x > 0)

    return fun(x-1);

    else

    return 100;

    }

    A. It prints: 0
    B. It prints: 10
    C. It prints: 100
    D. It prints: -1

  • Question 182:

    What happens when you attempt to compile and run the following code?

    #include

    using namespace std;

    int main()

    {

    int i = 4;

    while(i >= 0) {

    cout<

    i??;

    }

    return 0;

    }

    A. It prints:"43210"
    B. It prints:"3210"
    C. It prints: "3210?1"
    D. None of these

  • Question 183:

    What happens when you attempt to compile and run the following code?

    #include

    #include

    using namespace std;

    class complex{

    double re, im;

    complex() : re(1),im(0.4) {}

    complex operator?(complex andt);

    void Print() { cout << re << " " << im; }

    };

    complex complex::operator? (complex andt){

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

    }

    A. It prints: 1 0.4
    B. It prints: 2 0.8
    C. It prints: 0 0
    D. It prints: 1 0.8

  • Question 184:

    What is the output of the program?

    #include

    using namespace std;

    class BaseC

    {

    int i;

    public:

    BaseC() { i=?1;}

    BaseC(int i) { i=i; }

    void seti(int a) { i = a; };

    void Print() { cout << i; }

    };

    int main()

    {

    BaseC *o = new BaseC();

    o?>seti(10);

    o?>Print();

    }

    A. It prints: 10
    B. It prints: ?1
    C. It prints: 0
    D. Compilation error

  • Question 185:

    What is the expected result of the following program?

    A. It prints: 4
    B. The program enters an infinite loop
    C. It prints: 42
    D. It prints: 420

  • Question 186:

    What happens when you attempt to compile and run the following code?

    #include

    using namespace std;

    class Test {

    float i,j;

    };

    class Add {

    public:

    int x,y;

    Add (int a=3, int b=3) { x=a; y=b; }

    int result() { return x+y;}

    };

    int main () {

    Test test;

    Add * padd;

    padd = andtest;

    cout << padd?>result();

    return 0;

    }

    A. It prints: 6
    B. It prints: 9
    C. Compilation error
    D. It prints: 33

  • Question 187:

    What happens when you attempt to compile and run the following code?

    #include

    #include

    using namespace std;

    class complex{

    double re, im;

    public:

    complex() : re(1),im(0.4) {}

    complex operator+(complex andt);

    void Print() { cout << re << " " << im; }

    };

    complex complex::operator+ (complex andt){

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

    }

    A. It prints: 1 0.4
    B. It prints: 2 0.8
    C. It prints: 0 0
    D. Garbage value

  • Question 188:

    What is the output of the program?

    #include

    using namespace std;

    int main()

    {

    int tab[4]={10,20,30,40};

    tab[1]=10;

    int *p;

    p=andtab[0];

    cout<<*p;

    return 0;

    }

    A. It prints: 10
    B. It prints: 20
    C. It prints: 11
    D. It prints: 30

  • Question 189:

    What is the output of the program?

    #include

    #include

    using namespace std;

    struct t

    {

    int tab[2];

    };

    class First

    {

    struct t u;

    public:

    First() {

    u.tab[0] = 1;

    u.tab[1] = 0;

    }

    void Print(){

    cout << u.tab[0] << " " << u.tab[1];

    }

    };

    int main()

    {

    First t;

    t.Print();

    }

    A. It prints: 2 2
    B. It prints: 1 1
    C. It prints: 1 0
    D. It prints: 0 0

  • Question 190:

    What happens when you attempt to compile and run the following code?

    #include

    #include

    using namespace std;

    inline float sum(float a,float b)

    {

    return a+b;

    }

    int main()

    {

    float a,b;

    a = 1.5; b = 3.4;

    cout<

    return 0;

    }

    A. It prints: 0
    B. It prints: 4.9
    C. It prints: 5
    D. It prints: 4

Tips on How to Prepare for the Exams

Nowadays, the certification exams become more and more important and required by more and more enterprises when applying for a job. But how to prepare for the exam effectively? How to prepare for the exam in a short time with less efforts? How to get a ideal result and how to find the most reliable resources? Here on Vcedump.com, you will find all the answers. Vcedump.com provide not only C++ Institute exam questions, answers and explanations but also complete assistance on your exam preparation and certification application. If you are confused on your CPA-21-02 exam preparations and C++ Institute certification application, do not hesitate to visit our Vcedump.com to find your solutions here.