That's exactly it. I've observed that behaviour so often, I stopped counting. A lot of college/university students under very harsh time constraints learn the material with a focus on what they believe will get them the desired grade (be that passing or highest).
Meanwhile, they will leave out big chunks of the necessary foundations, because they won't be tested on their own. And then they mechanically learn the parts that will get tested, without understanding the underlying parts. They pass, usually, but that's more a problem of poorly written tests. (Because if you didn't _understand_ the material, I happen to think that you should fail a well written test.)