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

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

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

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

#include
class India
{
public:
struct Bix
{
int x;
float y;
void Function(void)
{
y = x = (x = 4*4);
y = --y * y;
}
void Display()
{
cout<< y << endl; } }B; }I; int main() { I.B.Display(); return 0; }

[A].0
[B].1
[C].-1
[D].Garbage value 

Answer: Option A

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

Cpp Programming, Objects And Classes

Cpp Programming Quiz 119 – Which of the following statements is correct about the program given below?

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

class Bix
{
public:
static void MyFunction();
};
int main()
{
void(*ptr)() = &Bix::MyFunction;
return 0;
}

[A].The program reports an error as pointer to member function cannot be defined outside the definition of class.
[B].The program reports an error as pointer to static member function cannot be defined.
[C].The program reports an error as pointer to member function cannot be defined without object.
[D].The program reports linker error. 

Answer: Option D

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

Cpp Programming, Objects And Classes