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

Which code lines inserted independently instead of the comment will make the following program work correctly? (Choose three.)

A.

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

B.

int main (int c, char *v[])

C.

int main

D.

void main ()

Which of the following statements are true? (Choose two.)

A.

Class A's friend's friend is also a friend of class A

B.

Friendship is inherited

C.

A class may be a friend of many classes

D.

A class may have many friends

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

#include

#include

using namespace std;

class A {

protected:

int y;

public:

int x, z;

A() : x(1), y(2), z(0) {}

A(int a, int b) : x(a), y(b) { z = x * y;}

void Print() { cout << z; }

};

class B : public A {

public:

int y;

B() : A() {}

B(int a, int b) : A(a,b) {}

void Print() { cout << z; }

};

int main () {

A b(2,5);

b.Print();

return 0;

}

A.

It prints: 10

B.

It prints: 2

C.

It prints: 5

D.

It prints: 1

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

#include

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;

}

A.

It prints: 2

B.

It prints: 5

C.

It prints: 10

D.

It prints: 0

How many times will the program print "HELLO" ?

#include

using namespace std;

int main()

{

cout<<"HELLO";

main();

return 0;

}

A.

65536

B.

32769

C.

1

D.

Till stack overflows

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

#include

using namespace std;

int fun(int x) {

return 2*x;

}

int main(){

int i;

i = fun(0.5) || fun(0);

cout << i;

return 0;

}

A.

It prints: 0

B.

It prints: 1

C.

It prints: -1

D.

Compilation error

Which line of code inserted instead of the comment will make the following code run properly without causing memory leaks?

A.

~Base() ( delete this; }

B.

no additional code is needed

C.

~Base() { delete ptr; delete ptr; }

D.

~Base() { delete ptr; }

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

#include

using namespace std;

int mul (int a, int b=2)

{

int r;

r=a*b;

return (r);

}

int main ()

{

cout << mul(1) << mul(2,4);

return 0;

}

A.

It prints: 2

B.

It prints: 28

C.

It prints: 8

D.

It prints: 6

What will variable "y" be in class B?

class A {

int x;

protected:

int y;

public:

int age;

};

class B : public A {

string name;

public:

void Print() {

cout << name << age;

}

};

A.

public

B.

private

C.

protected

D.

None of these

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

#include

#include

using namespace std;

class A {

protected:

int y;

public:

int x;

int z;

A() { x=1; 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: 10

B.

It prints: 2

C.

It prints: 6

D.

It prints: 5