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

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

    #include

    #include

    using namespace std;

    class A {

    public:

    A() { cout << "A no parameters";}

    A(string s) { cout << "A string parameter";}

    A(A anda) { cout << "A object A parameter";}

    };

    class B : public A {

    public:

    B() { cout << "B no parameters";}

    B(string s) { cout << "B string parameter";}

    };

    int main () {

    A a1;

    A a2("Test");

    B b1("Alan");

    return 0;

    }

    A. It prints: A no parametersA string parameterA no parametersB string parameter
    B. It prints: A no parametersB string parameter
    C. It prints: B string parameter
    D. It prints: B no parameter

  • Question 202:

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

    A. It prints: MaxNiels
    B. It prints: RobertMax
    C. It prints: RobertNiels
    D. It causes a compilation error

  • Question 203:

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

    A. It prints: 3
    B. It prints: 4
    C. It prints: 0
    D. It prints: 6

  • Question 204:

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

    A. It prints: 1
    B. It causes a compilation error
    C. It prints: -1
    D. It prints: 0

  • Question 205:

    Point out an error in the program.

    #include

    using namespace std;

    int main()

    {

    char s1[] = "Hello";

    char s2[] = "world";

    char *const ptr = s1;

    *ptr = 'a';

    ptr = s2;

    return 0;

    }

    A. No error
    B. Cannot modify a const object
    C. Compilation error at line 9
    D. None of these

  • Question 206:

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

    #include

    using namespace std;

    #include

    using namespace std;

    class First

    {

    public:

    void Print(){ cout<<"from First";}

    };

    int main()

    {

    First t[2];

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

    t[i].Print();

    }

    A. It prints: from First
    B. It prints: from Firstfrom First
    C. Compilation error
    D. Runtime error.

  • Question 207:

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

    #include

    using namespace std;

    class A {

    public:

    int x;

    A() { x=0;}

    };

    class B : protected A {

    public:

    int y;

    using A::x;

    B(int y) {this?>y = y;}

    void Print() { cout << x << y; }

    };

    int main () {

    B b(5);

    b.Print();

    return 0;

    }

    A. It prints: 05
    B. It prints: 0
    C. It prints: 5
    D. It prints: 15

  • Question 208:

    What is the output of the program given below?

    #include

    using namespace std;

    int main (int argc, const char * argv[])

    {

    int i=10;

    {

    int i=0;

    cout<

    }

    cout<

    return 0;

    }

    A. 1010
    B. 100
    C. 010
    D. None of these

  • Question 209:

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

    #include

    using namespace std;

    class BaseC

    {

    int *ptr;

    public:

    BaseC() { ptr = new int(10);}

    BaseC(int i) { ptr = new int(i); }

    ~BaseC() { delete ptr; }

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

    };

    int main()

    {

    BaseC *o = new BaseC(5);

    o?>Print();

    }

    A. It prints: 5
    B. It prints: 10
    C. It prints: 1
    D. It prints: 0

  • Question 210:

    Which of the following structures are correct?

    1:

    struct s1{

    int x;

    char c;

    };

    2:

    struct s2{

    float f;

    struct s2 *s;

    };

    3:

    struct s3{

    float f;

    in i;

    }

    A. 1
    B. 2
    C. 3
    D. All of these

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.