Q:

Size of colormap(gray)

I read on internet that a greyscale image has 256 possible values . But in matlab when i tried this :-
>> a=colormap(gray);
>> whos a
  Name       Size            Bytes  Class     Attributes

  a         64x3              1536  double  

It shows that colormap(gray) has only 64 values. Why is this so?

A:

The default length of a color map is 64 values.
You can use a=colormap(gray(256));, or better use: a=gray(256); for 256 values.  
In general colormap has now special treatment for grey levels.
colormap is kind of "Look Up Table" maps "index" to RGB triplet (greyscale triplet means R=G=B).
256 values is sufficient for all possible grey levels, but for covering all the RGB levels (assuming byte per color channel), you need: 256^3 = 16777216 values.  
The default 64 values applies 64 samples out of 256 grey levels (there are quantization "gaps" between samples).  
Examples:  
gray(2)
Result: 2 grey levels (0 and 1):
0     0     0  (black)
1     1     1  (white)  
gray(4)
Result: 4 grey levels:
0         0         0  (black)
0.3333    0.3333    0.3333  (dark grey)
0.6667    0.6667    0.6667  (light grey)
1.0000    1.0000    1.0000  (white)
As you can see, minimum is 0, maximum is 1, and levels in between are 1/3 and 2/3.  
Same principle for gray(64)...

