2022 Realistic CPA 100% Pass Guaranteed Download Exam Q&A [Q115-Q132]

Rate this post

2022 Realistic CPA 100% Pass Guaranteed Download  Exam Q&A

Accurate CPA Answers 365 Days Free Updates

QUESTION 115
What happens when you attempt to compile and run the following code?
#include <iostream>
using namespace std;
int main()
{
int x=2, *y;
y = &x;
cout << *y + x;
return 0;
}

 
 
 
 

QUESTION 116
Point out an error in the program.
#include <iostream>
using namespace std;
int main()
{
char s1[] = “Hello”;
char s2[] = “world”;
char *const ptr = s1;
*ptr = ‘a’;
ptr = s2;
return 0;
}

 
 
 
 

QUESTION 117
What is the output of the program if character 2 is supplied as input?
#include <iostream>
using namespace std;
int main () {
int c;
cin >> c;
try
{
switch (c)
{
case 1:
throw 20;
case 2:
throw 5.2f;
}
}
catch (int e)
{ cout << “int exception. Exception Nr. ” << e; }
catch (float e)
{ cout << “float exception. Exception Nr. ” << e; }
catch (…)
{ cout << “An exception occurred.”; }
return 0;
}

 
 
 
 

QUESTION 118
What happens when you attempt to compile and run the following code?
#include <iostream>
#include <string>
using namespace std;
void fun(int i);
int main()
{
int i=0;
i++;
for (i=0; i<=5; i++)
{
fun(i);
}
return 0;
}
void fun(int i)
{ if (i==3) return; cout << i; }

 
 
 
 

QUESTION 119
What happens when you attempt to compile and run the following code?
#include <iostream>
using namespace std;
int op(int x, int y)
{
return x?y;
}
int op(int x, float y)
{
return x+y;
}
int main()
{
int i=1, j=2, k, l;
float f=0.23;
k = op(i, j);
l = op(j, f);
cout<< k << “,” << l;
return 0;
}

 
 
 
 

QUESTION 120
What happens when you attempt to compile and run the following code?
#include <iostream>
#include <string>
using namespace std;
class complex{
double re;
double im;
public:
complex() : re(1),im(0.4) {}
bool operator==(complex &t);
};
bool complex::operator == (complex &t){
if((this?>re == t.re) && (this?>im == t.im))
return true;
else
return false;
}
int main(){
complex c1,c2;
if (c1==c2)
cout << “OK”;
else {
cout << “ERROR”;
}
}

 
 
 
 

QUESTION 121
What happens when you attempt to compile and run the following code?
#include <iostream>
using namespace std;
int f(int a, int b);
int main()
{
float b;
b = f(20,10);
cout << b;
return 0;
}
int f(int a, int b)
{
return a/b;
}

 
 
 
 

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

 
 
 
 

QUESTION 123
Which code, inserted at line 5, generates the output “ABC”?
#include <iostream>
using namespace std;
class A {
public:
//insert code here
};
class B:public A {
public:
void Print(){ cout<< “B”; }
};
class C:public B {
public:
void Print(){ cout<< “C”; }
};
int main()
{
A ob1;
B ob2;
C ob3;
A *obj;
obj = &ob1;
obj?>Print();
obj = &ob2;
obj?>Print();
obj = &ob3;
obj?>Print();
}

 
 
 
 

QUESTION 124
What happens when you attempt to compile and run the following code?
#include <iostream>
#include <string>
using namespace std;
class A {
public:
string s;
A(string s) { this->s = s; }
};
class B {
public:
string s;
B (A a) { this->s = a.s; }
void print() { cout<<s; }
};
int main()
{
A a(“Hello world”);
B b=a;
b.print();
}

 
 
 
 

QUESTION 125
What happens when you attempt to compile and run the following code?
#include <iostream>
using namespace std;
int main(){
int *i;
i = new int;
*i = 1.0 / 2 * 2 / 1 * 2 / 4 * 4;
cout << *i;
return 0;
}

 
 
 
 

QUESTION 126
What happens when you attempt to compile and run the following code?
#include <iostream>
#include <string>
using namespace std;
class Second;
class Base {
int age;
public:
Base () { age=5; };
friend void set(Base &ob, Second &so);
void Print() { cout << age;}
};
class Second {
string name;
public:
friend void set(Base &ob, Second &so);
void Print() { cout << name;}
};
void set(Base &ob, Second &so) {
ob.age = 0; so.name = “Bill”;
}
int main () {
Base a;
Second b;
set(a,b);
a.Print();
b.Print();
return 0;
}

 
 
 
 

QUESTION 127
What happens when you attempt to compile and run the following code?
#include <iostream> #include <string>
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 );
}

 
 
 
 

QUESTION 128
What happens when you attempt to compile and run the following code?
#include <iostream>
using namespace std;
class A {
public:
virtual void Print()=0;
};
class B:public A {
public:
virtual void Print() { cout<< “B”; }
};
class C:public A {
public:
virtual void Print() { cout<< “C”; }
};
int main()
{
B ob2;
C ob3;
A *obj;
obj = &ob2;
obj>Print();
obj = &ob3;
obj>Print();
}

 
 
 
 

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

 
 
 
 

QUESTION 130
What happens when you attempt to compile and run the following code?
#include <iostream>
using namespace std;
int main() {
float i = 1.0 / 2 * 2 / 1 * 2 / 4 * 4 / 2;
cout << i;
return 0;
}

 
 
 
 

QUESTION 131
What is the output of the program?
#include <iostream>
using namespace std;
#define SQR(x)(x*x)
int main(int argc, char *argv[]) {
int x, y=2;
x = SQR(y);
cout << x << “, ” <<y;
return 0;
}

 
 
 
 

QUESTION 132
What will the variable “age” be in class B?
class A {
int x;
protected:
int y;
public:
int age;
};
class B : protected A {
string name;
public:
void Print() {
cout << name << age;
}
};

 
 
 
 

CPA dumps Exam Material with 220 Questions: https://www.real4dumps.com/CPA_examcollection.html

Leave a Reply

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

Enter the text from the image below