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 121:

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

    A. It prints: T
    B. It prints an empty line
    C. It prints: Tesc
    D. It prints: st

  • Question 122:

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

    #include

    using namespace std;

    class A {

    public:

    void Print(){ cout<<"A";}

    };

    class C:public A {

    public:

    virtual void Print()=0;

    };

    int main()

    {

    C obj3;

    obj3?>Print();

    }

    A. It prints: BB
    B. It prints: A
    C. It prints: AB
    D. Compilation error

  • Question 123:

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

    #include

    using namespace std;

    int main()

    {

    int i = 0;

    i++;

    goto lab;

    i++;

    lab:

    cout<

    return 0;

    }

    A. It prints: 0
    B. It prints: 34
    C. It prints: 1
    D. It prints: 3

  • Question 124:

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

    #include

    using namespace std;

    class complex{

    double re;

    double im;

    public:

    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;

    }

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

  • Question 125:

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

    A. It prints: 5.2110.0
    B. It prints: 5.210.0
    C. It prints: 52.10
    D. It prints: 5210

  • Question 126:

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

    #include

    #include

    using namespace std;

    class SampleClass

    {

    string *s;

    public:

    SampleClass() { s = new string("Text");}

    SampleClass(string s) { this?>s = new string(s);}

    ~SampleClass() { delete s;}

    void Print(){ cout<<*s;}

    };

    int main()

    {

    SampleClass *obj;

    obj = new SampleClass("Test");

    obj?>Print();

    }

    A. It prints: Text
    B. It prints: Test
    C. It prints: TextTest
    D. Garbage value.

  • Question 127:

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

    #include

    using namespace std;

    int main()

    {

    float x=3.5,y=1.6;

    int i,j=2;

    i = x + j + y;

    cout << i;

    return 0;

    }

    A. It prints: 7
    B. It prints: 6
    C. It prints: 7,1
    D. Compilation error

  • Question 128:

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

    #include

    #include

    using namespace std;

    int main()

    {

    string s1[]= {"How" , "to" };

    s1[0].swap(s1[1]);

    for (int i=0; i<2; i++) {

    cout << s1[i];

    }

    return( 0 );

    }

    A. It prints: Hoto
    B. It prints: toHow
    C. It prints: Ht
    D. It prints: to

  • Question 129:

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

    #include

    using namespace std;

    class A

    {

    public:

    virtual void Print(){ cout<<"A";}

    };

    class B:public A

    {

    public:

    void Print(){ cout<< "B";}

    };

    int main()

    {

    A *obj;

    A ob1;

    obj = andob1;

    obj?>Print();

    B ob2;

    obj = andob2;

    obj?>Print();

    }

    A. It prints: AB
    B. It prints: AA
    C. It prints: BA
    D. It prints: BB

  • Question 130:

    What is the output of the program?

    #include

    using namespace std;

    #define PRINT(i) cout<

    int main()

    {

    int y=2, z=3;

    PRINT(y);

    PRINT(z);

    return 0;

    }

    A. It prints: 123
    B. It prints: 23
    C. It prints: 3
    D. It prints: 2

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.