Cpp Programming Quiz 238 – What will be the out of the following program?
[A].
0
[B].
100
[C].
200
[D].
400
Answer: Option C
Explanation:
No answer description available for this question.
100
[C].
200
[D].
400
Answer: Option C
Explanation:
No answer description available for this question.
#include
int main()
{
int m = 2, n = 6;
int &x = m++;
int &y = n++;
m = x++;
x = m++;
n = y++;
y = n++;
cout<< m << " " << n;
return 0;
}
[A].The program will print output 3 7.
[B].The program will print output 4 8.
[C].The program will print output 5 9.
[D].The program will print output 6 10.
Answer: Option E
#include
#include
{
static int x;
public:
IndiaBix()
{
if(x == 1)
exit(0);
else
x++;
}
void Display()
{
cout<< x << " ";
}
};
int IndiaBix::x = 0;
int main()
{
IndiaBix objBix1;
objBix1.Display();
IndiaBix objBix2;
objBix2.Display();
return 0;
}
[A].The program will print the output 1 2.
[B].The program will print the output 0 1.
[C].The program will print the output 1 1.
[D].The program will print the output 1.
Answer: Option D
Constructor is called either implicitly or explicitly, whereas destructor is always called implicitly.
[C].
Destructor is always called explicitly.
[D].
Constructor and destructor functions are not called at all as they are always inline.
Answer: Option B
Explanation:
No answer description available for this question.
#include
#include
class IndiaBix
{
public:
void GetData(char *s, int x, int y )
{
int i = 0;
for (i = x-1; y>0; i++)
{
cout<< s[i];
y--;
}
}
};
int main()
{
IndiaBix objBix;
objBix.GetData((char*)"Welcome!", 1, 3);
return 0;
}
[A].The program will print the output me!.
[B].The program will print the output Wel.
[C].The program will print the output !em.
[D].The program will print the output Welcome!.
Answer: Option B
Answer: Option A
Answer: Option B