Exams are supposed to be non-trivial, if they are to test your understanding of the material. When I teach freshman calculus, I invariably get this kind of comments from students who aced math in high school because they had basically memorized all possible question patterns from the textbook. But did they understand it? More often than not, they hadn't, really. And when they get a question that doesn't fit a pattern they've seen before, they call it a "trick", when it's anything but.
I work hard at getting my students to understand that math is not about memorizing stuff but about understanding stuff. You have to know the basic concepts and techniques by heart, of course, same as any subject, but anything more is just icing (unless your brain works in such a way that memorizing patterns helps you understand general principles, in which case memorize away, but don't mistake the means for the end.
Many students tell me they don't understand why they got a failing mark on an exam because they did all the homework and/or put in tens of hours of study. They seem to think that these actions should somehow guarantee them a passing grade, and if it didn't, it's obviously because the exam was unfair.
Now let me be perfectly clear: I don't give hard exams. In fact, most of the questions I ask are downright easy, provided you understand the material. Here's an example: "Sketch the graph of a twice-differentiable function f(x) whose domain is the real numbers and which satisfies the following two conditions: f'(x) is negative for all x, and f''(x) always has the same sign as x." This was in fact a question in my calc 1 midterm last year.
Out of 60 students, 10 did not write anything. 10 drew something that was not the graph of a function. 10 drew a function that did not satisfy any of the requirements. 10 drew a decreasing function but got the concavity wrong somehow. 20 gave a correct answer. (This is all approximate, of course.) The average mark for this question was probably around 2/5.
Was this exam question harder than my homework problem sets? Absolutely not! It's just different. Here's an example of a homework question relating to the same material in a similar way: "A differentiable function f(x) is such that f'(x) never changes sign. What can be said about the number of zeros of f?" This is more difficult than the exam question because the step linking the sign of f' to the number of zeros of f (drawing a graph) is not explicitly suggested, and because the answer is "f has at most one zero" and not "f has exactly one zero".