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

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

#include

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

}

A.

It prints: from First

B.

It prints: from Firstfrom First

C.

It prints: from Firstfrom Second

D.

It prints: from Secondfrom Second

What is the expected result of the following program?

A.

It prints: 4

B.

The program enters an infinite loop

C.

It prints: 42

D.

It prints: 420

What happens if you try to compile and run this program?

#include

using namespace std;

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

{

print("Test");

return 0;

}

void print(int c[])

{

cout<

}

A.

It prints: Test

B.

Compilation fails

C.

Program terminates abnormally

D.

None of these

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

#include

using namespace std;

class A {

public:

int x;

A() { x=0;}

};

class B : protected A {

public:

int y;

using A::x;

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

void Print() { cout << x << y; }

};

int main () {

B b(5);

b.Print();

return 0;

}

A.

It prints: 05

B.

It prints: 0

C.

It prints: 5

D.

It prints: 15

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

#include

#include

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

B(string s) : A(s) { tab = new int[size]; for (int i=0; i

~B() { delete tab; }

void Print() {

for (int i=0; i

cout << name;

}

};

int main () {

B b1("Alan");

B b2;

b1.tab[0]=0;

b1.Print(); b2.Print();

return 0;

}

A.

It prints: Alan

B.

It prints: 111

C.

It prints: 011Alan111Bob

D.

It prints: 0

What is the meaning of the following declaration? (Choose two.)

char **ptr;

A.

ptr is a pointer to a pointer to char

B.

ptr is a pointer to char*

C.

ptr is a pointer to a pointer to a pointer to char

D.

ptr is a pointer to char

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

A.

It prints: T

B.

It prints an empty line

C.

It prints: Tesc

D.

It prints: st

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

What is the output of the program given below?

#include

using namespace std;

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

{

float f=?10.501;

cout<<(int)f;

}

A.

0

B.

11

C.

?10

D.

?11

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

#include

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