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

    What happens if characters 'w', 'o', 'r', 'l' and 'd' are entered as input?

    #include

    #include

    using namespace std;

    int main()

    {

    string s1 = "Hello";

    string s2;

    getline( cin, s2 );

    cout << s1 + s2;

    return( 0 );

    }

    A. It prints: Helloworld
    B. It prints: Hello
    C. It prints: world
    D. Compilation error

  • Question 62:

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

    #include

    using namespace std;

    namespace myNamespace1

    {

    int x = 5;

    int y = 10;

    }

    namespace myNamespace2

    {

    float x = 3.14;

    float y = 1.5;

    }

    int main () {

    {

    using namespace myNamespace1;

    cout << x << " ";

    }{

    using namespace myNamespace2;

    cout << y;

    }

    return 0;

    }

    A. It prints: 5 1.5
    B. It prints: 3.14 10
    C. Compilation error
    D. None of these

  • Question 63:

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

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

    #include

    using namespace std;

    int op(int x, int y)

    {

    return x?y;

    }

    int op(int x, float y)

    {

    return x+y;

    }

    int main()

    {

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

    float f=0.23;

    k = op(i, j);

    l = op(j, f);

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

    return 0;

    }

    A. It prints: ?1,?1
    B. It prints: ?1,3
    C. It prints: ?1,2
    D. Compilation fails

  • Question 65:

    What will the variable "age" 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 66:

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

    using namespace std;

    int main()

    {

    int *a= new int;

    *a=100;

    cout << *a;

    delete a;

    }

    A. It prints: 1
    B. It prints: 100
    C. It prints: 0
    D. It prints: 10

  • Question 67:

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

    #include

    #include

    using namespace std;

    string fun(string, string);

    int main()

    {

    string s="Hello";

    cout << fun(s, " World");

    return 0;

    }

    string fun(string s1, string s2)

    {

    return s1+s2;

    }

    A. It will print: Hello World
    B. It will print: Hello
    C. It will print: World
    D. It will print: HW

  • Question 68:

    What is the output of the program?

    #include

    #include

    using namespace std;

    int main()

    {

    string s1="World";

    string s2;

    s2="Hello" + s1;

    cout << s2;

    return( 0 );

    }

    A. It prints: HelloWorld
    B. It prints: Hello
    C. It prints: World
    D. Compilation error

  • Question 69:

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

    Which of the following operators accept integer arguments only? (Choose two.)

    A. |
    B. | |
    C. ~
    D. !

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.