My laptop is making screeching sounds while charging

I have Compaq laptop, whenever I put it on charging it makes a very low but intense screeching sound, as soon as I switch off the charging the sound goes away. I have tried plugging in different sockets but no affect. Though it is not creating any performance trouble but still its intriguing and then I also want to know if its a serious matter!
