Can I get married in the UK while I am here on my student visa?
If you're already legally in the UK, and you can legally remain in the UK until you are married, then yes, you can marry in the UK. However if you only have a student visa, you will be in "status C", which means you don't have the proper immigration status. This doesn't prohibit your marrying, but according to the Northern Ireland's government's site you should give notice at a registrar's office as early as possible (preferably at least 70 days) to get the proper clearance from the Home Office (note that you also cannot give more than 90 days of notice).
Fees to get married might also be higher than usual, for example to marry in England and Wales it's £47 if you are only on a student visa, instead of the usual £35 (prices as of October 2016).
Is it necessary to have a wedding in the UK, or can I have a wedding in India and get it registered in the UK?
No, you don't need to get married in the UK, as the UK will accept any proper marriage certificate as long as it has an English translation as a proof of your marriage. However see the next section.
Will I be able to work in the UK after getting married to my boyfriend who is Hungarian?
Yes, but you might need to prove the authorities that your marriage is not of convenience. Having proofs that you are living together in the UK for a long time, and actually marrying somewhere in the UK instead of India might help in this process.