Showing posts with label SET4. Show all posts
Showing posts with label SET4. Show all posts

Wednesday, 18 June 2014

TECHNICAL INTERVIEW AND PRACTICE QUESTIONS ON C++ -- SET 4







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.


CLICK HERE TO SEE THE ANSWER

ANSWER IS   (C) AND (D)


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