Authentic CPA Dumps With 100% Passing Rate Practice Tests Dumps [Q125-Q142]

4/5 - (1 vote)

Authentic CPA Dumps With 100% Passing Rate Practice Tests Dumps

C++ Institute CPA Real Exam Questions Guaranteed Updated Dump from TestBraindump

NO.125 How many times will the program print “HELLO” ?
#include <iostream>
using namespace std;
int main()
{
cout<<“HELLO”;
main();
return 0;
}

 
 
 
 

NO.126 What happens when you attempt to compile and run the following code?
#include <iostream> #include <string> using namespace std;
class B;
class A { int age; public: A () { age=5; }; friend class B; };
class B { string name;
public:
B () { name=”Bob”; };
void Print(A ob) {
cout << name << ob.age;
}
};
int main () {
A a;
B b;
b.Print(a);
return 0;
}

 
 
 
 

NO.127 What is the output of the program if characters ‘t’, ‘e’, ‘s’ and ‘t’ enter are supplied as input?
#include <iostream> #include <string>
using namespace std;
int main()
{
string s;
getline( cin, s );
cout << s << ” ” << s.length();
return( 0 );
}

 
 
 
 

NO.128 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;
}
};

 
 
 
 

NO.129 Which of the following is a correct way to define the function fun() in the program below?
#include <iostream> #include <sstream> #include <string> using namespace std; int main() { int a[2][2]; fun(a); return 0; }

 
 
 
 

NO.130 Given:
#include <iostream>
#include <exception>
using namespace std;
int main () {
try
{
int * myarray= new int[1000];
}
catch (bad_alloc&)
{ cout << “Error allocating memory”; } catch (exception& e) { cout << “Standard exception”; } catch (…) { cout << “Unknown exception”; } return 0; }
What will happen if we use the operator “new” and the memory cannot be allocated?

 
 
 
 

NO.131 What happens when you attempt to compile and run the following code?
#include <iostream>
#include <string>
using namespace std;
class First
{
string *s;
public:
First() { s = new string(“Text”);}
~First() { delete s;}
void Print(){ cout<<*s;}
};
int main()
{
First FirstObject;
FirstObject.Print();
FirstObject.~First();
}

 
 
 
 

NO.132 What happens when you attempt to compile and run the following code?
#include <iostream>
#include <string>
using namespace std;
class A {
protected:
int y;
public:
int x;
int z;
A() { x=1; y=2; z=3; }
A(int a, int b) : x(a), y(b) { z = x * y;}
void Print() {
cout << z;
}
};
int main () {
A a(2,5);
a.Print();
return 0; }

 
 
 
 

NO.133 What happens when you attempt to compile and run the following code?
#include <iostream>
using namespace std;
class First
{
public:
First() { cout << “Constructor”;}
~First() { cout << “Destructor”;}
void Print(){ cout<<“from First”;}
};
int main()
{
First FirstObject;
FirstObject.Print();
}

 
 
 
 

NO.134 Which of the following structures are correct?
1:
struct s1{ int x; char c;
};
2:
struct s2{ float f; struct s2 *s;
};
3:
struct s3{ float f; in i;
}

 
 
 
 

NO.135 What happens when you attempt to compile and run the following code?
#include <cstdlib>
#include <iostream>
using namespace std;
float* sum(float a,float b);
float* sum(float a,float b)
{
float *f = new float;
*f = a+b;
return f;
}
int main()
{
float a,b,*f;
a = 1.5; b = 3.4;
f = sum(a,b);
cout<<*f;
return 0;
}

 
 
 
 

NO.136 What happens when you attempt to compile and run the following code?
#include <iostream> #include <string>
using namespace std;
class A {
protected:
int y;
public:
int x, z;
A() : x(1), y(2), z(0) {}
A(int a, int b) : x(a), y(b) { z = x * y;}
void Print() { cout << z; }
};
class B : public A {
public:
int y;
B() : A() {}
B(int a, int b) : A(a,b) {}
void Print() { cout << z; }
};
int main () {
A b(2,5);
b.Print();
return 0;
}

 
 
 
 

NO.137 How could you pass arguments to functions?

 
 
 
 

NO.138 What happens when you attempt to compile and run the following code?
#include <iostream>
using namespace std;
int compare(int, int);
int main()
{
int x = compare(10, 20);
cout << x;
return 0;
}
int compare(int i, int j)
{
return i<j;
}

 
 
 
 

NO.139 What happens when you attempt to compile and run the following code?
#include <iostream>
using namespace std;
class Base {
int age;
public:
class C {
int b;
void PrintC() { cout << b; }
};
Base () {age=5;};
void setAge(int a=20) {age = a;}
void Print() { cout << age;}
};
int main () {
Base a;
a.setAge(10);
a.Print();
return 0;
}

 
 
 
 

NO.140 What happens when you attempt to compile and run the following code?
#include <iostream>
using namespace std;
class First
{
public:
void Print(){ cout<<“from First”;}
};
class Second:public First
{
public:
void Print(){ cout<< “from Second”;}
};
void fun(First *obj);
int main()
{
First FirstObject;
fun(&FirstObject);
Second SecondObject;
fun(&SecondObject);
}
void fun(First *obj)
{
obj?>Print();
}

 
 
 
 

NO.141 What happens when you attempt to compile and run the following code?
#include <iostream> #include <string> using namespace std;
const int size = 3; class A {
public:
string name;
A() { name = “Bob”;}
A(string s) { name = s;}
A(A &a) { name = a.name;}
};
class B : public A {
public:
int *tab;
B() { tab = new int[size]; for (int i=0; i<size; i++) tab[i]=1;}
B(string s) : A(s) { tab = new int[size]; for (int i=0; i<size; i++) tab[i]=1;}
~B() { delete tab; }
void Print() {
for (int i=0; i<size; i++) cout << tab[i];
cout << name;
}
};
int main () {
B b1(“Alan”);
B b2;
b1.tab[0]=0;
b1.Print(); b2.Print();
return 0;
}

 
 
 
 

NO.142 What happens when you attempt to compile and run the following code?
#include <iostream>
using namespace std;
#include <iostream>
using namespace std;
class First
{
public:
void Print(){ cout<<“from First”;}
};
int main()
{
First t[2];
for (int i=0; i<2; i++)
t[i].Print();
}

 
 
 
 

Verified Pass CPA Exam in First Attempt Guaranteed: https://www.testbraindump.com/CPA-exam-prep.html

Related Links: myportal.utt.edu.tt myportal.utt.edu.tt myportal.utt.edu.tt myportal.utt.edu.tt myportal.utt.edu.tt myportal.utt.edu.tt

Leave a Reply

Your email address will not be published. Required fields are marked *

Enter the text from the image below