Cpp Programming Quiz 64 – Which of the following correctly describes overloading of functions?
[B]. Transient polymorphism[C]. Ad-hoc polymorphism
[D]. Pseudo polymorphism
Answer: Option C
Answer: Option C
5
[D].
Garbage-value
Answer: Option B
Explanation:
No answer description available for this question.
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
#include
#include
class IndiaBix
{
char txtMsg[50];
public:
IndiaBix(char *str = NULL)
{
if(str != NULL)
strcpy(txtMsg, str);
}
int BixFunction(char ch);
};
int IndiaBix::BixFunction(char ch)
{
static int i = 0;
if(txtMsg[i++] == ch)
return strlen((txtMsg + i)) - i;
else
return BixFunction(ch);
}
int main()
{
IndiaBix objBix("Welcome to IndiaBix.com!");
cout<< objBix.BixFunction('t');
return 0;
}
[A].6
[B].8
[C].9
[D].15
Answer: Option A
destructor
[C].
main
[D].
virtual function
Answer: Option B
Explanation:
No answer description available for this question.
#include
static double gDouble;
static float gFloat;
static double gChar;
static double gSum = 0;
class BaseOne
{
public:
void Display(double x = 0.0, float y = 0.0, char z = 'A')
{
gDouble = x;
gFloat = y;
gChar = int(z);
gSum = gDouble + gFloat + gChar;
cout << gSum;
}
};
class BaseTwo
{
public:
void Display(int x = 1, float y = 0.0, char z = 'A')
{
gDouble = x;
gFloat = y;
gChar = int(z);
gSum = gDouble + gFloat + gChar;
cout << gSum;
}
};
class Derived : public BaseOne, BaseTwo
{
void Show()
{
cout << gSum;
}
};
int main()
{
Derived objDev;
objDev.BaseTwo::Display(10, 20, 'Z');
return 0;
}
[A].The program will print the output 0.
[B].The program will print the output 120.
[C].The program will report run-time error.
[D].The program will report compile-time error.
Answer: Option D