Our pass rate is high to 98.9% and the similarity percentage between our CPA study guide and real exam is 90% based on our seven-year educating experience. Do you want achievements in the C++ Institute CPA exam in just one try? I am currently studying for the C++ Institute CPA exam. Latest C++ Institute CPA Test exam practice questions and answers, Try C++ Institute CPA Brain Dumps First.

Q81. - (Topic 2) 

What will be the output of the program?

 #include <iostream> 

using namespace std;

 int main()

 {

 int i=0;

 for(; i<=5; i++)

 cout << i;

 return 0;

 } 

A. 012345 

B. 0123 

C. 5 

D. 6 

Answer:


Q82. - (Topic 2) 

Which code, inserted at line 12, generates the output "5b"?

 #include <iostream> using namespace std; namespace myNamespace1 { int var = 5; } namespace myNamespace2 { char var = 'b' } int main () { //insert code here return 0; } 

A. cout << myNamespace1::var << var; 

B. cout << var << var; 

C. cout << myNamespace1::var << myNamespace2::var; 

D. None of these 

Answer:


Q83. - (Topic 2) 

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

#include <iostream>

 using namespace std;

int main() {

 int i, j;

 for(i = 0; i < 2; i++) {

 for(j = i; j < i + 1; j++) 

if(j == i)

 continue;

 else

 break;

 }

 cout << j;

 return 0;

 } 

A. It prints: 0 

B. It prints: 3 

C. It prints: 2 

D. It prints: 1 

Answer: C


Q84. - (Topic 2) 

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 {

 public:

 void set() { 

y = 4; z = 2;

 }

 void Print() {

 cout << y << z;

 }

 };

int main () {

 B b;

 b.set();

 b.Print();

 return 0;

 } 

A. It prints: 42 

B. It prints: 44 

C. It prints: 22 

D. It prints: 2 

Answer:


Q85. - (Topic 2) 

What is the output of the program if characters 'h', 'e', 'l', 'l' , 'o' and enter are supplied as input?

 #include <iostream>

 #include <string> 

using namespace std; 

void f(); 

int main() 

{

 f();

 return 0;

 }

void f()

 {

 char c;

 c = cin.get();

 cout << c;

 if(c != '\n')

 f();

 } 

A. It prints: hello 

B. It prints: olleh 

C. It prints: h 

D. It prints: o 

Answer:


Q86. - (Topic 2) 

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

 #include <iostream> 

using namespace std; 

int main()

 {

 int i = 5;

 cout<<"Hello World" << ++i;

 return 0;

 } 

A. It prints: Hello World6 

B. It prints: Hello 

C. It prints: World 

D. It prints: Hello World5 

Answer:


Q87. - (Topic 1) 

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

 #include <iostream>

 #include <string>

 using namespace std;

 class A { 

public:

 int x;

 A() { x=0;}

 A(int x) { this?>x=x;}

 };

class B : private A {

 public:

 using A::x;

 B() { x=1;}

 B(int x) {this?>x = x;}

 };

int main () {

 B c1;

 B c2(?5);

 cout << c1.x;

 cout << c2.x;

 return 0;

A. It prints: 5 

B. It prints: 1?5 

C. It prints: 05 

D. It prints: 0 

Answer:


Q88. - (Topic 1) 

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();

 } 

A. It prints: Hello world 

B. It prints: Hello 

C. Compilation error 

D. None of these 

Answer:


Q89. - (Topic 1) 

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

 #include <iostream>

 using namespace std;

 int fun(int x) {

 return x<<2;

 }

 int main(){

 int i;

 i = fun(1) / 2;

 cout << i; 

return 0;

 } 

A. It prints: 0 

B. It prints: 1 

C. It prints: 2 

D. It prints: 4 

Answer:


Q90. - (Topic 2) 

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

#include <iostream>

 using namespace std;

 class A { 

public :

 void print() {

 cout << "A "; 

};

 class B {

 public : 

void print() {

 cout << "B ";

 } 

};

 int main() {

 B sc[2];

 B *bc = (B*)sc;

 for (int i=0; i<2;i++)

 (bc++)->print();

 return 0;

 } 

A. It prints: A A 

B. It prints: B B 

C. It prints: A B 

D. It prints: B A 

Answer:


Q91. - (Topic 1) 

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

 #include <iostream> 

using namespace std;

 struct {

 int x;

 char c;

 union {

 float f;

 int i;

 };

 } s;

 int main (int argc, const char * argv[])

 {

 s.x=10; 

s.i=0;

 cout << s.i << " " << s.x;

 } 

A. It prints: 0 10 

B. It prints: 11 

C. Compilation error 

D. None of these 

Answer:


Q92. - (Topic 2) 

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

 #include <iostream> 

using namespace std; 

int main()

 {

 long int x,y=10;

 double d;

 d = 3.99;

 x=(int) d;

 cout << x <<", ";

 d=float (y);

 cout << d;

 return 0;

 } 

A. It prints: 3, 10 

B. It prints: 3.99, 10 

C. It prints: 4, 10.0 

D. It prints: 4, 10 

Answer:


Q93. - (Topic 1) 

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

 #include <iostream> 

using namespace std; 

int op(int x, int y); 

int main()

 {

 float *pf;

 float f=0.9;

 pf=&f;

 cout << op(1, *pf);

 return 0;

 } 

int op(int x, int y)

 {

 return x*y;

 } 

A. It prints: 0 

B. It prints: 0.5 

C. It prints: 1 

D. It prints: ?1 

Answer:


Q94. - (Topic 2) 

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

#include <iostream>

 using namespace std; 

int main()

 {

 int a=5;

 cout << ((a < 5) ? 9.9 : 9);

 } 

A. It prints: 9 

B. It prints: 9.9 

C. Compilation error 

D. None of these 

Answer:


Q95. - (Topic 2) 

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

using namespace std; 

class A {

 public:

 void Print(){ cout<<"A";}

 };

 class B:public A {

 public:

 virtual void Print(){ cout<< "B";}

 };

 class C:public B {

 public:

 void Print(){ cout<< "C";} 

};

 int main()

 {

 A ob1;

 B ob2;

 C ob3;

 B *obj;

 obj = &ob2;

 obj?>Print();

 obj = &ob3;

 obj?>Print();

 } 

A. It prints: BB 

B. It prints: AA 

C. It prints: BC 

D. It prints: AB 

Answer:


Q96. - (Topic 2) 

What will be the output of the program? 

#include <iostream>

 #include <string>

using namespace std; 

int fun(int);

 int main()

 {

 float k=3;

 k = fun(k);

 cout<<k;

 return 0;

 }

 int fun(int i)

 {

 i++;

 return i;

 } 

A. 3 

B. 5 

C. 4 

D. 5 

Answer: