I am going to buy a programmer and test it out. Will the bootloader be erased if hex code is uploaded using programmer? If I want to use back the Arduino IDE, do I have to re-upload the Arduino bootloader back?

Right.If an Arduino ("chip", et al.) is uploaded via ICSP then the bootloader gets wiped out.To then upload to the Arduino via USB/serial will require its being re-bootloaded.You can upload via ICSP from within the Arduino IDE, too.

"Who is like unto the beast? who is able to make war with him?"When all else fails, check your wiring!

I am going to buy a programmer and test it out. Will the bootloader be erased if hex code is uploaded using programmer? If I want to use back the Arduino IDE, do I have to re-upload the Arduino bootloader back?