Summer Special Limited Time 65% Discount Offer - Ends in 0d 00h 00m 00s - Coupon code: exc65

What is the output of the program?

#include

#include

using namespace std;

int main()

{

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

string s;

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

s = s1[i];

s.insert(1,"ow");

cout << s;

}

return( 0 );

}

A.

It prints: How

B.

It prints: Ht

C.

It prints: Hoto

D.

It prints: Howtow

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

A.

It prints: MaxNiels

B.

It prints: RobertMax

C.

It prints: RobertNiels

D.

It causes a compilation error

What is the output of the program?

#include

using namespace std;

#define SQR(x)(x*x)

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

int x, y=2;

x = SQR(y);

cout << x << ", " <

return 0;

}

A.

It prints: 3, 2

B.

It prints: 4, 2

C.

It prints: 3, 3

D.

It prints: 9, 2

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

#include

using namespace std;

#define A 1

int main()

{

#if A

cout<<"Hello";

#endif

cout<<"world";

return 0;

}

A.

It will print: Helloworld

B.

It will print: Hello

C.

It will print: world

D.

It will print: 0

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

#include

using namespace std;

class complex{

double re;

double im;

public:

complex() : re(0),im(0) {}

complex(double x) { re=x,im=x;};

complex(double x,double y) { re=x,im=y;}

void print() { cout << re << " " << im;}

};

int main(){

complex c1;

c1.print();

return 0;

}

A.

It prints: 1 0

B.

It prints: 1 1

C.

It prints: 0 0

D.

Compilation error

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

#include

#include

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

}

A.

It prints: Text

B.

It prints: Test

C.

It prints: TextTest

D.

Garbage value.

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

#include

#include

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";

}

}

A.

It prints: OK

B.

It prints: ERROR

C.

Compilation error

D.

Runtime error.

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

A.

It prints: 4

B.

It prints: 1

C.

It causes a compilation error

D.

lit prints: 0

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

#include

using namespace std;

void set(struct person*);

struct person

{

char name[25];

int age;

};

int main()

{

struct person e = {"Steve", 30};

set(&e);

cout<< e.name << " " << e.age;

return 0;

}

void set(struct person *p)

{

p?>age = p?>age + 1;

}

A.

Error: in prototype declaration unknown struct person

B.

Error: in structure

C.

It prints: Steve 31

D.

None of these

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

#include

#include

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