Got 0% on a midterm in Math Graduate school
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.