What is the output of following program?


			  		

Loading

Practice Function Overloading –

What is the output of following program?

#include
using namespace std;

class Base
{
public:
virtual void show() { cout<<" In Base "; }
};

class Derived: public Base
{
public:
void show() { cout<<"In Derived "; }
};

int main(void)
{
Base *bp = new Derived;
bp->show();

Base &br = *bp;
br.show();

return 0;
}

What will be the output of the following program?

Loading

Practice Function Overloading –

What will be the output of the following program?

#include 
class Crackexams {
int x, y;
public:
void show(void);
void main(void);
};
void Crackexams::show(void) {
Crackexams b;
b.x = 2;
b.y = 4;
cout<< x << " " << y;
}
void Crackexams::main(void) {
Crackexams b;
b.x = 6;
b.y = 8;
b.show();
}
int main(int argc, char *argv[]) {
Crackexams run;
run.main();
return 0;
}

What will be the output of the following program?

Loading

Practice Function Overloading –

What will be the output of the following program?

#include 
class Base {
int x, y;
public:
Base() {
x = y = 0;
}
Base(int xx) {
x = xx;
}
Base(int p, int q = 10) {
x = p + q;
y = q;
}
void Display(void) {
cout<< x << " " << y << endl;
}
objDefault(1, 1);
};
class Derived: public Base {
Base obj;
public:
Derived(int xx, int yy): Base(xx, xx + 1) { }
Derived(Base objB = objDefault) { }
};
int main() {
Derived objD(5, 3);
Derived *ptrD = new Derived(objD);
ptrD->Display();
delete ptrD;
return 0;
}

Which of the following statement is correct about the program given

Loading

Practice Function Overloading –

Which of the following statement is correct about the program given below?

#include  
static int Result;
class India {
public:
void Change(int x = 10, int y = 20, int z = 30) {
cout<< x + y + z;
}
void Display(int x = 40, float y = 50.00) {
Result = x % x;
cout<< Result;
}
};
class Try {
int x, y;
public:
void Change(int x, int y = 50) {
cout<< x + y;
}
};
class Crackexams: public India, public Try {
public:
void Display(int x = 10, int xx = 100, int xxx = 1000) {
Result = x + xx % x * x;
cout<< Result ;
}
};
int main() {
Crackexams objTry;
objTry.India::Display(10, 20.00);
return 0;
}

Which of the following statement is correct about the program given

Loading

Practice Function Overloading –

Which of the following statement is correct about the program given below?

#include  
class LGArray {
int array[3][3];
public:
LGArray(int arr[3][3] = NULL) {
if(arr != NULL) {
for(int i = 0; i < 3; i++) {
for(int j = 0; j < 3; j++) {
array[i][j] = i+j;
}
}
}
}
void Display(void) {
for(int i = 0; i < 3; i++) {
for(int j = 0; j < 3; j++) {
cout<< array[i][j] << " ";
}
}
}
};
int main() {
LGArray objBA;
objBA.Display();
return 0;
}

Find the output of following program?


			  		

Loading

Practice Function Overloading –

Find the output of following program?

#include
using namespace std;

class Base
{
public:
virtual void show() = 0;
};

int main(void)
{
Base b;
Base *bp;
return 0;
}

Which of the following approach is adapted by C++?

Loading

Practice Function Overloading –

Which of the following approach is adapted by C++?

What is the error in the following code?


			  		

Loading

Practice Function Overloading –

What is the error in the following code?

class t
{
virtual void print();
}

 

A pure virtual function is a virtual function that

Loading

Practice Function Overloading –

A pure virtual function is a virtual function that

Which of the following statements are correct?

Loading

Practice Function Overloading –

Which of the following statements are correct?

  1. A struct can contain properties.
  2. A struct can contain constructors.
  3. A struct can contain protected data members.
  4. A struct cannot contain methods.
  5. A struct cannot contain constants.