Question 46

What happens when you attempt to compile and run the following code?
#include <iostream> #include <string> using namespace std;
class A {
int x;
protected:
int y;
public:
int z;
A() { x=1; y=2; z=3; }
};
class B : public A {
string z;
public:
void set() { y = 4; z = "John"; }
void Print() { cout << y << A::z; }
};
int main () {
B b;
b.set();
b.Print();
return 0;
}
  • Question 47

    What happens when you attempt to compile and run the following code?
    #include <iostream>
    #include <string>
    using namespace std;
    class Base
    {
    string s;
    public:
    Base() { s="Sample text";}
    Base(string s) { this->s=s; }
    void Print() { cout << s; }
    };
    int main()
    {
    Base *o = new Base();
    o->Print();
    }
  • Question 48

    What happens when you attempt to compile and run the following code?
    #include <iostream>
    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;
    }
  • Question 49

    What happens when you attempt to compile and run the following code?
    #include <iostream>
    #include <string>
    using namespace std;
    class complex{
    double re, im;
    public:
    complex() : re(1),im(0.3) {}
    complex(double n) { re=n,im=n;};
    complex(int m,int n) { re=m,im=n;}
    complex operator+(complex &t);
    void Print() { cout << re << " " << im; }
    };
    complex complex::operator+ (complex &t){
    complex temp;
    temp.re = this?>re + t.re;
    temp.im = this?>im + t.im;
    return temp;
    }
    int main(){
    complex c1(1),c2(2),c3;
    c3 = c1 + c2;
    c3.Print();
    }
  • Question 50

    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;
    }
    };
  • Premium Bundle

    Newest CPA Exam PDF Dumps shared by BraindumpsPass.com for Helping Passing CPA Exam! BraindumpsPass.com now offer the updated CPA exam dumps, the BraindumpsPass.com CPA exam questions have been updated and answers have been corrected get the latest BraindumpsPass.com CPA pdf dumps with Exam Engine here:

    (220 Q&As Dumps, 40%OFF Special Discount: Exam-Tests)
    Other Version
    5444C++Institute.CPA.v2022-06-22.q125
    Latest Upload
    174EMC.D-AV-DY-23.v2026-12-03.q139
    135Cisco.350-101.v2026-12-03.q78
    233Nutanix.NCP-DB.v2026-12-02.q164
    148Huawei.H19-110_V2.0.v2026-12-02.q44
    241EXIN.ITILFNDv4.v2026-12-01.q148
    245VMware.2V0-13.25.v2026-12-01.q134
    163IBABC.CAIB-3.v2026-12-01.q17
    197Oracle.1Z1-136.v2026-11-30.q47
    288Salesforce.Nonprofit-Cloud-Consultant.v2026-11-30.q181
    341ISACA.COBIT-2019.v2026-11-30.q215