Master the CPA C++ Certified Associate Programmer content and be ready for exam day success quickly with this Examcollection CPA exams. We guarantee it!We make it a reality and give you real CPA questions in our C++ Institute CPA braindumps.Latest 100% VALID C++ Institute CPA Exam Questions Dumps at below page. You can use our C++ Institute CPA braindumps and pass your exam.

Q49. - (Topic 1) 

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

 #include <iostream> 

using namespace std; 

int main()

 {

 int x,y=10;

 float f;

 f = 5.20;

 x=(int) f;

 cout << x <<", ";

 f=float (y);

 cout << f;

 return 0;

 } 

A. It prints: 5, 10 

B. It prints: 5.2, 10 

C. It prints: 5.20, 10.0 

D. It prints: 5.2, 10.00 

Answer:


Q50. - (Topic 2) 

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; 

A. 1 

B. 2 

C. 3 

D. All of these 

Answer: A,B 


Q51. - (Topic 1) 

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

#include <iostream>

 #include <string>

 using namespace std;

class A {

 public:

 A() { cout << "A no parameters";}

 A(string s) { cout << "A string parameter";}

 A(A &a) { cout << "A object A parameter";}

 };

class B : public A {

 public:

 B() { cout << "B no parameters";} 

B(string s) { cout << "B string parameter";} };

 int main () { A a2("Test"); B b1("Alan"); B b2(b1); return 0;

 } 

A. It prints: A no parametersA no parametersB string parameter 

B. It prints: A string parameterA no parametersB string parameterA object A parameter 

C. It prints: A no parametersB string parameter 

D. It prints: A no parametersA no parameters 

Answer:


Q52. - (Topic 2) 

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

 } 

A. It prints: Constructorfrom First 

B. It prints: Constructorfrom FirstDestructor 

C. It prints: Constructorfrom FirstDestructorDestructor 

D. Compilation error at line 16 

Answer:


Q53. - (Topic 2) 

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;

 } 

A. void fun(int *p[2]) {} 

B. void fun(int *p[2][2]) {} 

C. void fun(int *p[][2]) {} 

D. void fun(int p[][2]) {} 

Answer:


Q54. - (Topic 2) 

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;

 } 

A. It prints: 0 

B. It prints: 1 

C. It prints: -1 

D. It prints: 2 

Answer:


Q55. - (Topic 2) 

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;

 } 

A. It prints: Hello 

B. It prints: world 

C. It prints: End 

D. It prints: E 

Answer:


Q56. - (Topic 2) 

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

 #include <iostream>

 using namespace std;

 int main() { int i = 5; 

do {

 i??;

 cout<<i;

 }

 while(i >= 0);

 return 0;

 } 

A. It prints: 43210?1 

B. It prints: ?1 

C. It prints: 4321 

D. It prints: 1 

Answer:


Q57. - (Topic 2) 

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

#include <iostream>

 #include <string> 

using namespace std; 

int main()

 {

 string s1[]= {"H" , "t" }; 

string s;

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

 s = s1[i];

 s.insert(1,"o");

 cout << s;

 }

 return( 0 );

 } 

A. It prints: Hoto 

B. It prints: Ho 

C. It prints: to 

D. It prints: Ht 

Answer:


Q58. - (Topic 1) 

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;

 } 

A. It prints: 0 

B. It prints: 1 

C. It prints: -1 

D. It prints: 2 

Answer:


Q59. - (Topic 1) 

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

 } 

A. Garbage value 

B. It prints: AlanAlan 

C. It prints: Alan 

D. It prints: Al 

Answer:


Q60. - (Topic 2) 

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

using namespace std;

 int main()

 { 

int x,y=10;

 float f;

 f = 5.90;

 cout << f << ", ";

 x=f;

 cout << x <<", ";

 f=y;

 cout << f;

 return 0;

 } 

A. It prints: 5, 5, 10.00 

B. It prints: 5.9, 5, 10 

C. It prints: 6, 5, 10 

D. It prints: 6, 5, 10.00 

Answer:


Q61. - (Topic 2) 

Which of the following operations is INCORRECT? 

A. int i=15; 

B. long int k=123 

C. float f=12,2; 

D. double d=12; 

Answer:


Q62. - (Topic 2) 

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:

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

 };

 int main()

 {

 A *obj;

 A ob1;

 obj = &ob1;

 obj?>Print();

 B ob2;

 obj = &ob2;

 obj?>Print();

 } 

A. It prints: AB 

B. It prints: AA 

C. It prints: BA 

D. It prints: BB 

Answer:


Q63. - (Topic 1) 

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=2; 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;

 } 

A. It prints: ?3 

B. It prints: 2 

C. It prints: 6 

D. It prints: 5 

Answer:


Q64. - (Topic 1) 

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

#include <iostream>

 using namespace std;

int fun(int x);

int main() {

 cout << fun(0);

 return 0;

 }

int fun(int x) {

 if(x > 0)

 return fun(x-1);

 else

 return 100;

 } 

A. It prints: 0 

B. It prints: 10 

C. It prints: 100 

D. It prints: -1 

Answer: