Object Oriented Programming

1:

Consider the following program segment.
static char X [3] = "1234" ;
cout <<  X ;

A complete c++ program with these two statements     

A.

prints 12 3 4

B.

prints 12 3

C.

prints 1234 followed by some junk

D.

will give a compilation error

 

Answer : D

Explanation :

c++ forbids initialization with strings, whose length is more than the size of the array. C compiler permits.

Write your comments here:


Report Error
 

Option: A

Explanation : Explanation will come here. Explanation will come here. Explanation will come here. Explanation will come here. Explanation will come here.