I disagree. Waving one person's success at a group as a way of reprimanding the ones who didn't do as well is guaranteed to create resentment and other types of negativity. It's a way for an authority figure to say, "You guys are such stupid losers, but Joey here just so amazing and brilliant. He's a winner." You can't make a statement guaranteed to make people feel rotten about themselves and then blame them for feeling exactly the way that was intended.
There was nothing in HowlerKarma's anecdote that indicated "brandishing" by the instructor. She doesn't indicate HOW the friends found out at all. If they were as close then as they eventually ended up, they probably would have found out whether the instructor revealed it or not. If I were in a class with my significant other, I'd want to know how she did.
FWIW, I'm intimately familiar with the kind of negativity and resentment that can come about from public test scores, and the stakes were a heckuva lot higher than grades or class ranking. I'm talking about military ranking here. I was promoted, and others, with a lot more experience, who thought they were more deserving, who were more personally invested in their careers, were not, and this was due almost entirely to my test score. There were even people higher up the food chain who were upset, and did take it out on me in some interesting ways.
I got over it, because being promoted was still better than not being promoted, and ultimately I proved that I truly did deserve it.