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
    :May 11, 2024

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

  • Question 211:

    What will the variable "y" be in class B?

    class A {

    int x;

    protected:

    int y;

    public:

    int age;

    };

    class B : private A {

    string name;

    public:

    void Print() {

    cout << name << age;

    }

    };

    A. public

    B. private

    C. protected

    D. None of these

  • Question 212:

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

    #include

    using namespace std;

    int main()

    {

    float x=3.5,y=1.6;

    int i,j=2;

    i = x + j + y;

    cout << i;

    return 0;

    }

    A. It prints: 7

    B. It prints: 6

    C. It prints: 7,1

    D. Compilation error

  • Question 213:

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

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

    #include

    using namespace std;

    class complex{

    double re, im;

    public:

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

    complex operator+(complex andt);

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

    };

    complex complex::operator+ (complex andt){

    complex temp;

    temp.re = this?>re + t.re;

    temp.im = this?>im + t.im;

    return temp;

    }

    int main(){

    complex c1,c2,c3;

    c3 = c1 + c2;

    c3.Print();

    }

    A. It prints: 1 0.4

    B. It prints: 2 0.8

    C. It prints: 0 0

    D. Garbage value

  • Question 215:

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

    #include

    using namespace std;

    void fun(int);

    int main()

    {

    int a=0;

    fun(a);

    return 0;

    }

    void fun(int n)

    {

    if(n < 2)

    {

    fun(++n);

    cout << n;

    }

    }

    A. It prints: 21

    B. It prints: 012

    C. It prints: 0

    D. None of these

  • Question 216:

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

    #include

    using namespace std;

    int s(int n);

    int main()

    {

    int a;

    a = 3;

    cout << s(a);

    return 0;

    }

    int s(int n)

    {

    if(n == 0) return 1;

    return s(n?1)*n;

    }

    A. It prints: 4

    B. It prints: 6

    C. It prints: 3

    D. It prints: 0

  • Question 217:

    What will be the output of the program?

    #include

    using namespace std;

    int fun(int);

    int main()

    {

    cout << fun(5);

    return 0;

    }

    int fun(int i)

    {

    return i*i;

    }

    A. 25

    B. 5

    C. 0

    D. 1

  • Question 218:

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

    #include

    #include

    using namespace std;

    class complex{

    double re, im;

    public:

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

    complex operator?(complex andt);

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

    };

    complex complex::operator? (complex andt){

    complex temp;

    temp.re = this?>re ? t.re;

    temp.im = this?>im ? t.im;

    return temp;

    }

    int main(){

    complex c1,c2,c3;

    c3 = c1 ? c2;

    c3.Print();

    }

    A. It prints: 1 0.4

    B. It prints: 2 0.8

    C. It prints: 0 0

    D. It prints: 1 0.8

  • Question 219:

    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 = 3.0;

    c1.print();

    return 0;

    }

    A. It prints: 0 0

    B. It prints: 1 1

    C. It prints: 3 3

    D. Compilation error

  • Question 220:

    What will the variable "age" be in class B?

    class A {

    int x;

    protected:

    int y;

    public:

    int age;

    A () { age=5; };

    };

    class B : public A {

    string name;

    public:

    B () { name="Bob"; };

    void Print() {

    cout << name << age;

    }

    };

    A. public

    B. private

    C. protected

    D. None of these

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.