Cpp Programming 73 – Which of the following is the correct class of the object cout?
[B]. istream[C]. ostream
[D]. ifstream
Answer: Option C
Answer: Option C
Answer: Option C
#include
struct MyData
{
public:
int Addition(int a, int b = 10)
{
return (a *= b + 2);
}
float Addition(int a, float b);
};
int main()
{
MyData data;
cout<
[A].12 12
[B].12 18
[C].3 14
[D].18 12
Answer: Option B
copy constructor
[C].
Both A and B
[D].
None of these
Answer: Option A
Explanation:
No answer description available for this question.
#include
int main()
{
int x = 80;
int y& = x;
x++;
cout << x << " " << --y;
return 0;
}
[A].The program will print the output 80 80.
[B].The program will print the output 81 80.
[C].The program will print the output 81 81.
[D].It will result in a compile time error.
Answer: Option D
#include
#include
class IndiaBix
{
char str[50];
char tmp[50];
public:
IndiaBix(char *s)
{
strcpy(str, s);
}
int BixFunction()
{
int i = 0, j = 0;
while(*(str + i))
{
if(*(str + i++) == ' ')
*(tmp + j++) = *(str + i);
}
*(tmp + j) = 0;
return strlen(tmp);
}
};
int main()
{
char txt[] = "Welcome to IndiaBix.com!";
IndiaBix objBix(txt);
cout<< objBix.BixFunction();
return 0;
}
[A].1
[B].2
[C].24
[D].25
Answer: Option B
#include
class IndiaBix
{
static int x;
public:
static void SetData(int xx)
{
this->x = xx;
}
static void Display()
{
cout<< x ;
}
};
int IndiaBix::x = 0;
int main()
{
IndiaBix::SetData(22);
IndiaBix::Display();
return 0;
}
[A].The program will print the output 0.
[B].The program will print the output 22.
[C].The program will print the output Garbage.
[D].The program will report compile time error.
Answer: Option D