What will be the output of the following program?

Loading

Practice Functions –

What will be the output of the following program?

#include 
#include
class TryString {
char x[50];
char y[50];
char z[50];
public:
TryString() { }
TryString(char* xx) {
strcpy(x, xx);
strcpy(y, xx);
}
TryString(char *xx, char *yy = " C++", char *zz = " Programming!") {
strcpy(z, xx);
strcat(z, yy);
strcat(z, zz);
}
void Display(void) {
cout<< z << endl;
}
};
int main() {
TryString objStr("Learn", " Java");
objStr.Display();
return 0;
}

What will be the output of the following program?

Loading

Practice Functions –

What will be the output of the following program?

#include 
class TestDrive {
int x;
public:
TestDrive(int xx) {
x = xx;
}
int DriveIt(void);
};
int TestDrive::DriveIt(void) {
static int value = 0;
int m;
m = x % 2;
x = x / 2;
if((x / 2)) {
DriveIt();
}
value = value + m * 10;
return value;
}
int main() {
TestDrive TD(1234);
cout<< TD.DriveIt() * 10 << endl;
return 0;
}

What will be the output of the following program?

Loading

Practice Functions –

What will be the output of the following program?

#include  
class AreaFinder {
float l, b, h;
float result;
public:
AreaFinder(float hh = 0, float ll = 0, float bb = 0) {
l = ll;
b = bb;
h = hh;
}
void Display(int ll) {
if(l = 0) {
result = 3.14f * h * h;
}
else {
result = l * b;
cout<< result;
}
}
};
int main() {
AreaFinder objAF(10, 10, 20);
objAF.Display(0);
return 0;
}

Which of the following statements are correct?

  1. String is

Loading

Practice Functions –

Which of the following statements are correct?

  1. String is a value type.
  2. String literals can contain any character literal including escape sequences.
  3. The equality operators are defined to compare the values of string objects as well as references.
  4. Attempting to access a character that is outside the bounds of the string results in an IndexOutOfRangeException.
  5. The contents of a string object can be changed after the object is created.