Exam Details

  • Exam Code
    :CPA
  • Exam Name
    :C++ Certified Associate Programmer
  • Certification
    :C++ Certified Professional Programmer
  • Vendor
    :C++ Institute
  • Total Questions
    :220 Q&As
  • Last Updated
    :Apr 20, 2024

C++ Institute C++ Certified Professional Programmer CPA Questions & Answers

  • Question 1:

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

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

    #include

    #include

    using namespace std;

    int main()

    {

    string s1[]= {"How" , "to" };

    s1[0].swap(s1[1]);

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

    cout << s1[i];

    }

    return( 0 );

    }

    A. It prints: Hoto

    B. It prints: toHow

    C. It prints: Ht

    D. It prints: to

  • Question 3:

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

    using namespace std;

    int main()

    {

    const char *s;

    char str[] = "Hello";

    s = str;

    while(*s) {

    cout << *s++;

    }

    return 0;

    }

    A. It prints: el

    B. It prints: Hello

    C. It prints: H

    D. It prints: o

  • Question 4:

    What will be the output of the program?

    #include

    #include

    using namespace std;

    int fun(int);

    int main()

    {

    float k=3;

    k = fun(k);

    cout<

    return 0;

    }

    int fun(int i)

    {

    i++;

    return i;

    }

    A. 3

    B. 5

    C. 4

    D. 5

  • Question 5:

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

    #include

    using namespace std;

    #define A 1

    int main()

    {

    #if A

    cout<<"Hello";

    #endif

    cout<<"world";

    return 0;

    }

    A. It will print: Helloworld

    B. It will print: Hello

    C. It will print: world

    D. It will print: 0

  • Question 6:

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

    #include

    using namespace std;

    int main()

    {

    int i = 4;

    while(i >= 0) {

    cout<

    i??;

    }

    return 0;

    }

    A. It prints:"43210"

    B. It prints:"3210"

    C. It prints: "3210?1"

    D. None of these

  • Question 7:

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

    #include

    #include

    using namespace std;

    class complex{

    double re;

    double im;

    public:

    complex() : re(1),im(0.4) {}

    bool operator==(complex andt);

    };

    bool complex::operator == (complex andt){

    if((this?>re == t.re) andand (this?>im == t.im))

    return true;

    else

    return false;

    }

    int main(){

    complex c1,c2;

    if (c1==c2)

    cout << "OK";

    else {

    cout << "ERROR";

    }

    }

    A. It prints: OK

    B. It prints: ERROR

    C. Compilation error

    D. Runtime error.

  • Question 8:

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

    #include

    using namespace std;

    class A {

    public :

    void print() {

    cout << "A ";

    }

    };

    class B {

    public :

    void print() {

    cout << "B ";

    }

    };

    int main() {

    B sc[2];

    B *bc = (B*)sc;

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

    (bc++)->print();

    return 0;

    }

    A. It prints: A A

    B. It prints: B B

    C. It prints: A B

    D. It prints: B A

  • Question 9:

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

    #include

    using namespace std;

    class Base {

    static int age;

    public:

    Base () {};

    ~Base () {};

    void setAge(int a=20) {age = a;}

    void Print() { cout << age;}

    };

    int Base::age=0;

    int main () {

    Base a;

    A. setAge(10);

    B. Print();

    C. setAge();

    D. Print(); return 0; }

    E. It prints: 10

    F. It prints: 20

    G. It prints: 1020

    H. It prints: 2010

  • Question 10:

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

    #include

    using namespace std;

    void fun(char*);

    int main()

    {

    char t[4]={'0', '1', '2', '3'};

    fun(andt[0]);

    return 0;

    }

    void fun(char *a)

    {

    cout << *a;

    }

    A. It prints: 01

    B. It prints: 1

    C. It prints: 0

    D. It prints: 0123

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 exam preparations and C++ Institute certification application, do not hesitate to visit our Vcedump.com to find your solutions here.