Cpp Programming Quiz 143 – Which of the following access specifies is used in a class definition by default?
[A]. Protected
[B]. Public[C]. Private
[D]. Friend
Answer: Option C
[D]. Friend
Answer: Option C
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 A
Explanation:
No answer description available for this question.
[B].
Answer: Option B
Explanation:
Both mean two different things. arr gives the address of the first int, whereas the &arr gives the address of array of ints.
#include
class IndiaBix
{
int x;
float y;
public:
IndiaBix(int x)
{
x = x;
}
IndiaBix(int p = 0, int q = 10)
{
x = p += 2;
y = q * 1.0f;
}
void SetValue(int &y, float z)
{
x = y;
y = (int)z;
}
void Display(void)
{
cout<< x;
}
};
int main()
{
int val = 12;
IndiaBix objBix(val);
IndiaBix objTmp();
objBix.SetValue(val, 3.14f);
objBix.Display();
return 0;
}
[A].The program will print the output 2.
[B].The program will print the output 12.
[C].The program will report run time error.
[D].The program will not compile successfully.
Answer: Option D
[A].
Only 1 is correct.
[B].Only 2 is correct.
[C].
Both 1 and 2 are correct.
[D].
Both 1 and 2 are incorrect.
Answer: Option D
Explanation:
No answer description available for this question.
destructor
[C].
main
[D].
virtual function
Answer: Option B
Explanation:
No answer description available for this question.
#include
int main()
{
int x = 10;
int &y = x;
x++;
cout<< x << " " << y++;
return 0;
}[A].The program will print the output 11 12.
[B].The program will print the output 12 11.
[C].The program will print the output 12 13.
[D].It will result in a compile time error.
Answer: Option B