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

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

    #include

    using namespace std;

    int main()

    {

    int i=2;

    switch(i)

    {

    case 1:

    cout<<"Hello";

    break;

    case 2:

    cout<<"world";

    break;

    case 3:

    printf("End");

    break;

    }

    return 0;

    }

    A. It prints: Hello

    B. It prints: world

    C. It prints: End

    D. It prints: E

  • Question 142:

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

    #include

    using namespace std;

    class First

    {

    public:

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

    };

    class Second

    {

    public:

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

    };

    int main()

    {

    Second t[2];

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

    t[i].Print();

    }

    A. It prints: from First

    B. It prints: from Firstfrom First

    C. It prints: from Secondfrom Second

    D. It prints: from Second

  • Question 143:

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

    A. It prints: 13

    B. It prints: l

    C. It prints: 12

    D. It prints: 2

  • Question 144:

    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];

    if (i==0)

    s.insert(1,"ow");

    else

    s.push_back('o');

    cout << s;

    }

    return( 0 );

    }

    A. It prints: Hoto

    B. It prints: Ht

    C. It prints: toHo

    D. It prints: Howto

  • Question 145:

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

    A. It prints: AAABDD

    B. It pints: AABD

    C. It prints: AABDD

    D. It causes a compilation error

  • Question 146:

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

    using namespace std;

    int fun(int x) {

    return 2*x;

    }

    int main(){

    int i;

    i = fun(0.5) || fun(0);

    cout << i;

    return 0;

    }

    A. It prints: 0

    B. It prints: 1

    C. It prints: -1

    D. Compilation error

  • Question 147:

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

    #include

    using namespace std;

    int op(int x, int y)

    {

    int i;

    i = x + y;

    return i;

    }

    int main()

    {

    int i=1, j=2, k, l;

    k = op(i, j);

    l = op(j, i);

    cout<< k << "," << l;

    return 0;

    }

    A. It prints: 1,2

    B. It prints: ?1,1

    C. It prints: 1,1

    D. It prints: 3,3

  • Question 148:

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

    #include

    using namespace std;

    class A

    {

    public:

    virtual void Print()=0;

    };

    class B:public A

    {

    public:

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

    };

    int main()

    {

    B ob2;

    A *obj;

    obj = andob2;

    obj?>Print();

    }

    A. It prints: B

    B. It prints: A

    C. It prints: AB

    D. It prints: BA

  • Question 149:

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

    #include

    using namespace std;

    int main()

    {

    int i = 0;

    do {

    i++;

    if (i==3)

    break;

    cout<

    }

    while(i < 5);

    return 0;

    }

    A. It prints: 12

    B. It prints: 1

    C. It prints: 0

    D. No output

  • Question 150:

    A condition expression used by if(), while(), and do-while() must evaluate to and only to:

    A. an int type value

    B. any value that can be treated as truth/falsehood

    C. a float type value

    D. a bool type value

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.