Got 0% on a midterm in Math Graduate school The title says it all, I studied very hard I would say, and it’s seemed to amount to nothing. I mainly focused on one part of the material since we only had to solve 2 out of the 4 problems on the exam and usually 2 questions where from what I focused on. As luck had it, there was only 1 problem for what I have studied for, and the problem was very hard and I could not solve it. The other problems seemed almost unsolvable unless you have seen the trick before , which I have not. Thus I could not solve any of the problems.  The exam was supposed to mimic the qualifying exam, and the mean was 65%.

I have no idea how to move forward from here. It makes me feel like I am not cut out for math graduate school. What keeps me sane is the fact that I do well on the homework’s , when I have time to look at them.

Oddly enough I think the biggest pain is the shame and feeling of disappointing the professor. I visit his office hours regularly to ask questions and I end up with a 0%.. it will be humiliating having to pick up the midterm.

Any advice as to how to move on From here would be appreciated. Should I treat this as a wake up call and start studying harder and use this as motivation? Or should I just give up?
Remember exams are supposed to measure your mastery of the material, and if you focus on only two out of four topics, you haven't mastered all the material - at best you've mastered 50%. Trying to game a passing score this way is not a winning strategy; even if it works, you'll come out of grad school thinking you barely learned anything (example).

That said, one failed midterm isn't the end of your graduate program. It's likely even one failed course isn't the end either. You will however need to step up your game. If you're able to do the homework but not the exams, figure out why. You alluded to you being able to "having time to look at the homework". If this is the reason, then you must work faster. Try doing the homework problem with solution covered up, and timing yourself. Repeat it several times. The time you need should go down, and if you can do that, you can solve the exam questions in the time available too.