Cpp Programming 79 – Which of the following problem causes an exception?
[B]. A problem in calling function.[C]. A syntax error.
[D]. A run-time error.
Answer: Option D
Answer: Option D
#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
[B].
[C].
[D].
Answer: Option C
Explanation:
The statement ‘C’ is correct. When we pass an array as a funtion argument, the base address of the array will be passed.
Answer: Option C
[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 A
#include
enum xyz
{
a, b, c
};
int main()
{
int x = a, y = b, z = c;
int &p = x, &q = y, &r = z;
p = ++x;
q = ++y;
r = ++c;
cout<< p << q << r;
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 0 1 2.
[D].It will result in a compile time error.
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 C