Cpp Programming 91 – Which of the following is an invalid visibility label while inheriting a class?
[B]. private[C]. protected
[D]. friend
Answer: Option D
Answer: Option D
#include
class IndiaBix
{
public:
void Bix(int x = 15)
{
x = x/2;
if(x > 0)
Bix();
else
cout<< x % 2;
}
};
int main()
{
IndiaBix objIB;
objIB.Bix();
return 0;
}
[A]. The program will display 1.
[B]. The program will display 2.
[C]. The program will display 15.
[D]. The program will go into an infinite loop.
Answer: Option D
Answer: Option A
#include
class IndiaBix
{
static int count;
public:
static void First(void)
{
count = 10;
}
static void Second(int x)
{
count = count + x;
}
static void Display(void)
{
cout<< count << endl;
}
};
int IndiaBix::count = 0;
int main()
{
IndiaBix :: First();
IndiaBix :: Second(5);
IndiaBix :: Display();
return 0;
}
[A].0
[B].5
[C].10
[D].15
Answer: Option D
#include
int main()
{
int x = 10, y = 20;
int *ptr = &x;
int &ref = y;
*ptr++;
ref++;
cout<< x << " " << y;
return 0;
}
[A]. The program will print the output 10 20.
[B]. The program will print the output 10 21.
[C]. The program will print the output 11 20.
[D]. The program will print the output 11 21.
Answer: Option B
Answer: Option A
The program will print the output Garbage-value.
[C].
The program will report compile time error.
[D].
The program will report runtime error.
Answer: Option C
Explanation:
No answer description available for this question.