Is it better to pull out of exams or fail them?
You should go and speak to your course lecturers as soon as possible, and put in a request for special consideration on the basis of illness.  Your university should have a policy of how to apply for special consideration, and the criteria for granting consideration.  This differs from place to place, but most universities are accommodating of problems caused by illness (assuming you can give evidence of this via medical certificates, etc.).  Given your position, I would suggest you request for them to allow you to defer assessment in your courses until you have had time to recover from your illness and study for the exams.  If this is too much for them, then as a fall-back position, ask them to allow you to withdraw from the courses without failure.  Whatever you do, don't just make a unilateral decision on what to do without speaking to your lecturers --- discuss your circumstances with them and find out their position.