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

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

    #include

    using namespace std;

    int main()

    {

    int i = 0;

    i++;

    goto lab;

    i++;

    lab:

    cout<

    return 0;

    }

    A. It prints: 0

    B. It prints: 34

    C. It prints: 1

    D. It prints: 3

  • Question 192:

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

    #include

    using namespace std;

    void fun(int*);

    int main()

    {

    int *x;

    int i=2;

    x=andi;

    fun(x);

    cout<

    return 0;

    }

    void fun(int *i)

    {

    *i = *i * *i;

    }

    A. It prints: 2

    B. It prints: 4

    C. It prints: 0

    D. It prints: 1

  • Question 193:

    What is the output of the program if characters 'h', 'e', 'l', 'l' , 'o' and enter are supplied as input?

    #include

    #include

    using namespace std;

    void f();

    int main()

    {

    f();

    return 0;

    }

    void f()

    {

    char c;

    c = cin.get();

    cout << c;

    if(c != '\n')

    f();

    }

    A. It prints: hello

    B. It prints: olleh

    C. It prints: h

    D. It prints: o

  • Question 194:

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

    #include

    using namespace std;

    int main()

    {

    int x,y=10;

    float f;

    f = 5.90;

    cout << f << ", ";

    x=f;

    cout << x <<", ";

    f=y;

    cout << f;

    return 0;

    }

    A. It prints: 5, 5, 10.00

    B. It prints: 5.9, 5, 10

    C. It prints: 6, 5, 10

    D. It prints: 6, 5, 10.00

  • Question 195:

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

    #include

    using namespace std;

    int f(int a, int b);

    int main()

    {

    float b;

    b = f(20,10);

    cout << b;

    return 0;

    }

    int f(int a, int b)

    {

    return a/b;

    }

    A. It prints: 2

    B. It prints: 5

    C. It prints: 10

    D. It prints: 0

  • Question 196:

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

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

    #include

    using namespace std;

    int mul (int a, int b=2)

    {

    int r;

    r=a*b;

    return (r);

    }

    int main ()

    {

    cout << mul(1) << mul(2,4);

    return 0;

    }

    A. It prints: 2

    B. It prints: 28

    C. It prints: 8

    D. It prints: 6

  • Question 198:

    What will be the output of the program?

    #include

    using namespace std;

    int main()

    {

    int i=0;

    for(; i<=5; i++)

    cout << i;

    return 0;

    }

    A. 012345

    B. 0123

    C. 5

    D. 6

  • Question 199:

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

    #include

    using namespace std;

    class complex{

    double re;

    double im;

    public:

    complex() : re(0),im(0) {}

    complex(double x) { re=x,im=x;};

    complex(double x,double y) { re=x,im=y;}

    void print() { cout << re << " " << im;}

    };

    int main(){

    complex c1;

    c1.print();

    return 0;

    }

    A. It prints: 1 0

    B. It prints: 1 1

    C. It prints: 0 0

    D. Compilation error

  • Question 200:

    How many times will "HELLO" be printed?

    #include

    using namespace std;

    int main()

    {

    for(int i=?1; i<=10; i++)

    {

    if(i < 5)

    continue;

    else

    break;

    cout<<"HELLO";

    }

    return 0;

    }

    A. 1

    B. 2

    C. 0

    D. 20

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.