Question 46

What happens when you attempt to compile and run the following code?
#include <iostream>
using namespace std;
class A
{
public:
virtual void Print(){ cout<<"A";}
};
class B:public A
{
public:
void Print(){ cout<< "B";}
};
int main()
{
A *obj;
A ob1;
obj = &ob1;
obj>Print();
B ob2;
obj = &ob2;
obj>Print();
}
  • Question 47

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

    What is the output of the program?
    #include <iostream>
    #include <string>
    using namespace std;
    class First
    {
    string name;
    public:
    First() {
    name = "Alan";
    }
    void Print(){
    cout << name;
    }
    };
    int main()
    {
    First ob1,*ob2;
    ob2 = new First();
    ob1.Print(); ob2->Print(); }
  • Question 49

    What happens when you attempt to compile and run the following code?
    #include <iostream>
    using namespace std;
    int main(){
    int i = 1;
    if (--i==1) {
    cout << i;
    } else {
    cout << i-1;
    }
    return 0;
    }
  • Question 50

    If there is one, point out an error in the program
    #include <iostream>
    using namespace std;
    int main() {
    int c = 'a';
    switch(i)
    {
    case '2':
    cout<<"OK";
    case '1':
    cout<<"Error";
    default:
    break;
    }
    return 0;
    }
  • 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
    4322C++Institute.CPA.v2024-03-18.q106
    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