Halloween Special - Limited Time 70% Discount Offer - Ends in 0d 00h 00m 00s - Coupon code: sntaclus

Which of the following operators accept integer arguments only? (Choose two.)

A.

|

B.

| |

C.

~

D.

!

What will happen if the memory cannot be allocated?

A.

The program will print: Standard exception

B.

The program will print: Unknown exception

C.

The program will cause a compilation error

D.

The program will print: Error allocating memory

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(1) || fun(2);

cout << i;

return 0;

}

A.

It prints: 0

B.

It prints: 1

C.

It prints: -1

D.

Compilation error

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

#include

#include

using namespace std;

void fun(int i);

int main()

{

int i=0;

i++;

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

{

fun(i);

}

return 0;

}

void fun(int i)

{

if (i==3)

return;

cout << i;

}

A.

It prints: 05

B.

It prints: 012345

C.

It prints: 01245

D.

It prints: 0

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

A.

It prints: 33

B.

It prints: –31

C.

It prints: –1–1

D.

It prints: –13

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:

void Print(){ cout<< "from Second";}

};

int main()

{

Second t[2];

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

t[i].Print();

}

A.

It prints: from First

B.

It prints: from Firstfrom First

C.

It prints: from Secondfrom Second

D.

It prints: from Second

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

#include

#include

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

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

#include

using namespace std;

class A {

public:

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

};

class C:public A {

public:

virtual void Print()=0;

};

int main()

{

C obj3;

obj3?>Print();

}

A.

It prints: BB

B.

It prints: A

C.

It prints: AB

D.

Compilation error

What is the output of the program if character “1” is supplied as input?

#include

using namespace std;

int main () {

int c;

cin >> c;

try

{

switch (c)

{

case 1:

throw 20;

case 2:

throw 5.2f;

case 3:

throw 'a';

}

}

catch (int e)

{ cout << "int exception. Exception Nr. " << e; }

catch (float e)

{ cout << "float exception. Exception Nr. " << e; }

catch (...)

{ cout << "An exception occurred."; }

return 0;

}

A.

It prints: float exception. Exception Nr. 5.2

B.

It prints: int exception. Exception Nr. 20

C.

It prints: An exception occurred

D.

Compilation Error

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

#include

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