what is use of alt=""
it is better if u use it because it helps search engines also in identifying the content of the image there by helping in search engine optimization
if for some reason the image cannot be displayed then the viewer of the page will get information about the image.
is it necessary to use this?
No it is not necessary but like said it does things that are handy
Alt attribute specifies an alternate text for an image, if the image cannot be displayed.