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

    What is the output of the program?

    #include

    using namespace std;

    #define SQR(x)(x*x)

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

    int x, y=2;

    x = SQR(y);

    cout << x << ", " <

    return 0;

    }

    A. It prints: 3, 2

    B. It prints: 4, 2

    C. It prints: 3, 3

    D. It prints: 9, 2

  • Question 172:

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

    #include

    #include

    using namespace std;

    class Base

    {

    string s;

    public:

    Base() { s="Sample text";}

    Base(string s) { this?>s=s; }

    void Print() { cout << s; }

    };

    int main()

    {

    Base *o = new Base();

    o?>Print();

    }

    A. It prints: Sample text

    B. It prints: Sample

    C. It prints: text

    D. None of these

  • Question 173:

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

    A. It prints: 4

    B. It prints: 1

    C. It causes a compilation error

    D. lit prints: 0

  • Question 174:

    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:

    virtual 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 175:

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

    D. It prints: My exception,

  • Question 176:

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

    A. It prints: 33

    B. It prints: 007

    C. It causes a compilation error

    D. lit prints: 9

  • Question 177:

    Which of the following statements may completely ignore their bodies (inner statements)? (Choose three.)

    A. do

    B. swicch

    C. for

    D. while

  • Question 178:

    What is the output of the program?

    #include

    #include

    using namespace std;

    int main()

    {

    string s1[]= {"H" , "t" };

    string s;

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

    s = s1[i];

    s.insert(1,"ow");

    cout << s;

    }

    return( 0 );

    }

    A. It prints: How

    B. It prints: Ht

    C. It prints: Hoto

    D. It prints: Howtow

  • Question 179:

    Which code line instead of the comment below will cause the program to produce the expected output?

    A. a = b * c;

    B. return a = b * c;

    C. return a = b * *c;

    D. a = b * *c;

  • Question 180:

    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;

    t.Print();

    }

    A. It prints: 30

    B. It prints: John

    C. It prints: John 30

    D. It prints: John 30John 30

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.