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
    :Jul 18, 2025

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

  • Question 211:

    What is the expected output of the following program?

    A. It prints: 432

    B. It prints: 321

    C. It prints: 4321

    D. It prints: 3210

  • Question 212:

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

    #include

    #include

    using namespace std;

    class A {

    int x;

    protected:

    int y;

    public:

    int z;

    A() { x=1; y=2; z=3; }

    };

    class B : public A {

    public:

    void set() {

    y = 4; z = 2;

    }

    void Print() {

    cout << y << z;

    }

    };

    int main () {

    B b;

    b.set();

    b.Print();

    return 0;

    }

    A. It prints: 42

    B. It prints: 44

    C. It prints: 22

    D. It prints: 2

  • Question 213:

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

    #include

    using namespace std;

    void set(struct person*);

    struct person

    {

    char name[25];

    int age;

    };

    int main()

    {

    struct person e = {"Steve", 30};

    set(ande);

    cout<< e.name << " " << e.age;

    return 0;

    }

    void set(struct person *p)

    {

    p?>age = p?>age + 1;

    }

    A. Error: in prototype declaration unknown struct person

    B. Error: in structure

    C. It prints: Steve 31

    D. None of these

  • Question 214:

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

    A. It prints: 10

    B. It prints: 2+32+3

    C. It prints: 7

    D. It prints: 22+3

  • Question 215:

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

    A. It causes a compilation error

    B. It prints: Tesc failed

    C. .It prints: failed

    D. It prints: Tesc

  • Question 216:

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

    A. It prints: 33

    B. It prints: ?1

    C. It prints: ??

    D. It prints: ?3

  • Question 217:

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

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

    #include

    #include

    using namespace std;

    class A {

    protected:

    int y;

    public:

    int x, z;

    A() : x(1), y(2), z(0) {}

    A(int a, int b) : x(a), y(b) { z = x * y;}

    void Print() { cout << z; }

    };

    class B : public A {

    public:

    int y;

    B() : A() {}

    B(int a, int b) : A(a,b) {}

    void Print() { cout << z; }

    };

    int main () {

    A b(2,5);

    b.Print();

    return 0;

    }

    A. It prints: 10

    B. It prints: 2

    C. It prints: 5

    D. It prints: 1

  • Question 219:

    Analyze the code below. If it contains an error, indicate its place in the program.

    A. Error in the for loop

    B. Error in the break statement

    C. No error

    D. Error in the if statement

  • Question 220:

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

    #include

    using namespace std;

    class BaseC

    {

    public:

    int *ptr;

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

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

    ~BaseC() { delete ptr; }

    };

    void fun(BaseC x);

    int main()

    {

    BaseC *o = new BaseC(5);

    fun(*o);

    }

    void fun(BaseC x) { cout << "Hello:"<<*x.ptr; }

    A. It prints: Hello:50

    B. It prints: Hello:10

    C. It prints: Hello:5

    D. Compilation error

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.