An exam can change the course of your life, but it can't ruin it. Read all of the questions before you begin, and try to allocate your time. Do the easy problems first, trying to pick up fast points. If time permits, check your work. If you believe that a question covers material not on the syllabus, note this on your answer sheet, but still try to answer the question.
Most departments have procedures for appealing the results of an exam.
If you believe that your exam has been graded incorrectly, compose a thoughtful, concise, and non-belligerent summary of what you believe the error to be. Concentrate on errors that you can document in textbooks or by other objective means.