SET 4 TECHNICAL INTERVIEW QUESTIONS ON C++
1. Consider the following code
void main()
{
int x =10;
int &p=x;
cout<< &p<<&x;
}
(a) prints 10 and the adress of x (b) results in run time error
(c) prints the address of x twice (d) prints the adress of p twice.
2. Which of the following is not an storage class in c++
(a) register (b) auto (c) mutable (d) dynamic
3. Consider the following program segment
static char x[3] = " 1234";
cout<<x;
These two segments with complete program will print
(a) prints 123 (b) prints 12345
(c) prints 1234 followed by some junk (d) will give a compilation error
ANSWER IS (C) AND (D)