The medals are awarded to the students purely on the basis of the percentage of your score in your two or four years of coursework be it in B.Tech, M.Tech, MBA, MCA, etc.
You will receive a gold medal if your score is the highest of all the students in the institute. If your percentage of marks is below 70% you will get the first-class certificate and if your percentage is 70% or higher then you will get a distinction or a graded certificate.