Cpp Programming 90 – Which of the following header file includes definition of cin and cout?
[B]. ostream.h
[D]. iostream.h
Answer: Option D
Answer: Option D
class Birds {};
class Peacock : protected Birds {};
[A].[ez-toc] It will not compile because class body of Birds is not defined.
[B].It will not compile because class body of Peacock is not defined.
[C].It will not compile because a class cannot be protectedly inherited from other class.
[D].It will compile succesfully.
Answer: Option D
delete
[C].
delete[]
[D].
kill[]
Answer: Option C
Explanation:
No answer description available for this question.
#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;
}
[A].300
[B].200
[C].Garbage value
[D].400
Answer: Option D
#include
class IndiaBix
{
int x, y;
public:
void SetValue(int &xx, int &yy)
{
x = xx ++;
y = yy;
Display();
}
void Display()
{
cout<< x << " " << y;
}
};
int main()
{
int x = 10;
int &y = x;
IndiaBix objBix;
objBix.SetValue(x , y);
return 0;
}
[A].The program will print the output 10 10.
[B].The program will print the output 10 11.
[C].The program will print the output 11 11.
[D].The program will print the output 11 10.
Answer: Option B
#include
class IndiaBix
{
int x;
float y;
public:
IndiaBix(int x)
{
x = x;
}
IndiaBix(int p = 0, int q = 10)
{
x = p += 2;
y = q * 1.0f;
}
void SetValue(int &y, float z)
{
x = y;
y = (int)z;
}
void Display(void)
{
cout<< x;
}
};
int main()
{
int val = 12;
IndiaBix objBix(val);
IndiaBix objTmp();
objBix.SetValue(val, 3.14f);
objBix.Display();
return 0;
}
[A].The program will print the output 2.
[B].The program will print the output 12.
[C].The program will report run time error.
[D].The program will not compile successfully.
Answer: Option D
[D]. Both A and B
Answer: Option C