The short answer is yes in most cases. (Only voters who planned to both vote for McCain in the general and a majority of Dems in other races, or who had voted for a majority of Dems in the previous election, would be in compliance.)
There's no real good way to enforce the law, however. And that's a good thing. I don't want my government knowing for whom I voted.
But the point here is that Americans have a civic duty -- especially when it comes to the democratic process -- to do their very best to follow the law, whether or not they run the risk of being punished.
© Jed Lewison