Hey there bro!
I'm a fellow student at IITD (2017 entry). I read about the situation and understood that you made a mistake. It's a good thing you realize this too. You may or may not get marks for this, but I want to touch on a broader issue here.
You asked what you can do to stop feeling bad. And what others do when they make a mistake. I can tell you how I deal with making mistakes, and it might prove helpful for you too. I have been the person to kick myself every time I do something I do not like, sometimes regretting it immediately after I do it. One thing that has helped me in situations like yours is to look at how the current mistake figures into my goal. This could be an immediate goal, like scoring well in a course, or larger goals for my life or career. I find that often, in the grand scheme of things, individual mistakes and bad days don't matter as much as I might expect. And even when they do, say when I want to score well, there are often ways to adapt, like future quizzes I can prepare for. Can mistakes make it harder to do things I had planned? Yes, and that is life. But life also gives me days of good luck, when things are easier than I expect. It is a good idea to notice these good days too. The point is, I can hardly expect things to be just like I want, but I can almost always be sure that there is another way forward.
Feeling sad or scared is okay, and making mistakes is okay too. Just keep moving.