Our website is made possible by displaying online advertisements to our visitors. Please consider supporting us by whitelisting our website.

C++ Programming

Cpp Programming Quiz 108 – What will be the output of the following program?

Question: What will be the output of the following program?

#include
class BixTeam
{
int x, y;
public:
BixTeam(int xx)
{
x = ++xx;
}
void Display()
{
cout<< --x << " "; } }; int main() { BixTeam objBT(45); objBT.Display(); int *p = (int*)&objBT; *p = 23; objBT.Display(); return 0; }

[A].45 22
[B].46 22
[C].45 23
[D].46 23

Answer: Option A

Cpp Programming Quiz 108 – What will be the output of the following program? Read More »

Cpp Programming, Objects And Classes

Cpp Programming Quiz 109 – Which of the following statement is correct about the program given below?

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

#include
class BixData
{
int x, y, z;
public:
BixData(int xx, int yy, int zz)
{
x = ++xx;
y = ++yy;
z = ++zz;
}
void Show()
{
cout<< "" << x++ << " " << y++ << " " << z++; } }; int main() { BixData objData(1, 2, 3); objData.Show(); return 0; }

[A].The program will print the output 1 2 3.
[B].The program will print the output 2 3 4 .
[C].The program will print the output 4 5 6.
[D].The program will report compile time error.

Answer: Option B

Cpp Programming Quiz 109 – Which of the following statement is correct about the program given below? Read More »

Cpp Programming, Objects And Classes

Cpp Programming Quiz 110 – Which of the following statement is correct about the program given below?

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

#include
class BixBase
{
int x, y;
public:
BixBase(int xx = 10, int yy = 10)
{
x = xx;
y = yy;
}
void Show()
{
cout<< x * y << endl; } }; class BixDerived : public BixBase { private: BixBase objBase; public: BixDerived(int xx, int yy) : BixBase(xx, yy), objBase(yy, yy) { objBase.Show(); } }; int main() { BixDerived objDev(10, 20); return 0; }

[A].The program will print the output 100.
[B].The program will print the output 200.
[C].The program will print the output 400.
[D].The program will print the output Garbage-value.

Answer: Option C

Cpp Programming Quiz 110 – Which of the following statement is correct about the program given below? Read More »

Cpp Programming, Objects And Classes

Cpp Programming Quiz 111 – Which of the following statement is correct about the program given below?

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

#include
class BixBase
{
int x, y;
public:
BixBase(int xx = 10, int yy = 10)
{
x = xx;
y = yy;
}
void Show()
{
cout<< x * y << endl; } }; class BixDerived : public BixBase { private: BixBase objBase; public: BixDerived(int xx, int yy) : BixBase(xx, yy) { objBase.Show(); } }; int main() { BixDerived objDev(10, 20); return 0; }

[A].The program will print the output 100.
[B].The program will print the output 200.
[C].The program will print the output Garbage-value.
[D].The program will report compile time error. 

Answer: Option A

Cpp Programming Quiz 111 – Which of the following statement is correct about the program given below? Read More »

Cpp Programming, Objects And Classes

Cpp Programming Quiz 112 – Which of the following statement is correct about the program given below?

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

#include
class BixBase
{
int x, y;
public:
BixBase(int xx = 10, int yy = 10)
{
x = xx;
y = yy;
}
void Show()
{
cout<< x * y << endl; } }; class BixDerived { private: BixBase objBase; public: BixDerived(int xx, int yy) : objBase(xx, yy) { objBase.Show(); } }; int main() { BixDerived objDev(10, 20); return 0; }

[A].The program will print the output 100.
[B].The program will print the output 200.
[C].The program will print the output Garbage-value.
[D].The program will report compile time error. 

Answer: Option B

Cpp Programming Quiz 112 – Which of the following statement is correct about the program given below? Read More »

Cpp Programming, Objects And Classes

Cpp Programming Quiz 113 – Which of the following statement is correct about the program given below?

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

#include
class IndiaBix
{
static int x;
public:
static void SetData(int xx)
{
x = xx;
}
static void Display()
{
cout<< x ; } }; int IndiaBix::x = 0; int main() { IndiaBix::SetData(44); IndiaBix::Display(); return 0; }

[A].The program will print the output 0.
[B].The program will print the output 44.
[C].The program will print the output Garbage.
[D].The program will report compile time error. 

Answer: Option B

Cpp Programming Quiz 113 – Which of the following statement is correct about the program given below? Read More »

Cpp Programming, Objects And Classes

Cpp Programming Quiz 114 – Which of the following statement is correct about the program given below?

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

#include
class IndiaBix
{
static int x;
public:
static void SetData(int xx)
{
x = xx;
}
void Display()
{
cout<< x ; } }; int IndiaBix::x = 0; int main() { IndiaBix::SetData(33); IndiaBix::Display(); return 0; }

[A].The program will print the output 0.
[B].The program will print the output 33.
[C].The program will print the output Garbage.
[D].The program will report compile time error. 

Answer: Option D

Cpp Programming Quiz 114 – Which of the following statement is correct about the program given below? Read More »

Cpp Programming, Objects And Classes

Cpp Programming Quiz 115 – Which of the following statement is correct about the program given below?

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

#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

Cpp Programming Quiz 115 – Which of the following statement is correct about the program given below? Read More »

Cpp Programming, Objects And Classes

Cpp Programming Quiz 116 – Which of the following statement is correct about the program given below?

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

#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

Cpp Programming Quiz 116 – Which of the following statement is correct about the program given below? Read More »

Cpp Programming, Objects And Classes

Cpp Programming Quiz 117 – Which of the following statement is correct about the program given below?

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

#include
#include class IndiaBix
{
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

Cpp Programming Quiz 117 – Which of the following statement is correct about the program given below? Read More »

Cpp Programming, Objects And Classes