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

4.  Which of the following operators cannot be overloaded?

(a)  >>                      (b)  >:              (c) .                     (d) no such  operator exists



CLICK HERE TO SEE THE ANSWER

ANSWER IS (B) AND (C)



5. CLASS DOG : PUBLIC A, PUBLIC B
   is an example of

(a)  Multiple Inheritence                              (b)  Repeated Inheritence

(c)  Linear Inheritence                                 (d)  None of these





No comments:

Post a Comment