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

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

    #include

    using namespace std;

    int min(int a, int b);

    int main()

    {

    int min(int,int);

    int b;

    b = min(10,20);

    cout << b;

    return 0;

    }

    int min(int a, int b)

    {

    return(b);

    }

    A. It prints: 20
    B. It prints: 10
    C. It prints: 1020
    D. It prints: 2010

  • Question 72:

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

    #include

    #include

    using namespace std;

    struct Person {

    string name;

    int age;

    };

    class First

    {

    Person *person;

    public:

    First() {person = new Person;

    person?>name = "John";

    person?>age = 30;

    }

    void Print(){

    cout<name << " "<< person?>age;

    }

    };

    int main()

    {

    First t[2];

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

    t[i].Print();

    }

    A. It prints: 30
    B. It prints: John
    C. It prints: John 31
    D. It prints: John 30John 30

  • Question 73:

    What will the variable "y" be in class B?

    class A {

    int x;

    protected:

    int y;

    public:

    int age;

    };

    class B : protected A {

    string name;

    public:

    void Print() {

    cout << name << age;

    }

    };

    A. public
    B. private
    C. protected
    D. None of these

  • Question 74:

    What will variable "y" be in class B?

    class A {

    int x;

    protected:

    int y;

    public:

    int age;

    };

    class B : public A {

    string name;

    public:

    void Print() {

    cout << name << age;

    }

    };

    A. public
    B. private
    C. protected
    D. None of these

  • Question 75:

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

    #include

    using namespace std;

    int main()

    {

    int i = 5;

    do {

    i??;

    cout<

    }

    while(i >= 0);

    return 0;

    }

    A. It prints: 43210?1
    B. It prints: ?1
    C. It prints: 4321
    D. It prints: 1

  • Question 76:

    Which code, inserted at line 10, generates the output "2?1"?

    #include

    #include

    using namespace std;

    class A {

    protected:

    int y;

    public:

    int z;

    };

    //insert code here

    public:

    void set() {

    y = 2;

    z = 3;

    }

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

    };

    int main () {

    B b;

    b.set();

    b.z

    = ?1; b.Print(); return 0; }

    A. class B : private A {
    B. class B : public A {
    C. class B : protected A {
    D. class B {

  • Question 77:

    Which of the following statements are correct?

    A. A function can be defined inside another function
    B. A function may have any number of return statements each returning different values.
    C. A function can return floating point value
    D. In a function two return statements should never occur.

  • Question 78:

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

    #include

    using namespace std;

    int main(){

    int i = 1;

    if (i==1) {

    cout << i;

    } else {

    cout << i-1;

    }

    return 0;

    }

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

  • Question 79:

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

    #include

    using namespace std;

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

    {

    int a = 30, b = 1, c = 5, i=10;

    i = b < a < c;

    cout << i;

    return 0;

    }

    A. compilation fails
    B. It prints: 10
    C. It prints: 0
    D. It prints: 1

  • Question 80:

    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<

    }

    {

    int i=5;

    cout << i;

    }

    cout<

    return 0;

    }

    A. 1010
    B. 101010
    C. 0510
    D. None 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.