To "take" an exam is to sit down with the exam paper, answer the questions, turn it in, and receive "a grade" or "a score."
To "pass" an exam is to receive a "passing grade." That means your work was good enough. It was acceptable. You have officially accomplished something. You have "passed" a milestone.
The opposite of "passing" an exam is "failing" an exam.
To "fail" an exam is to receive a "failing grade." That means your work was not good enough. If it was the final exam in a course, you will not get credit for the course. If it was an examination to get a driver's license, you will not get the license. You will need to take the exam again.
In the US, one (of many) systems of grades uses the letters A, B, C, D, and F. In US slang, to "ace" a test is to receive an A, the highest letter grade. To "flunk" a test is to fail it, perhaps by receiving an F.