There can be any number of reasons. Sometimes the questions are asked in different tags, which tend to have their own "communities" and voting practices. The time of day a post gets it's most attention affects the nationalities of the people most likely to be online. Sometimes it's just luck; the people that happened to choose that question were more inclined to vote one way or another. Sometimes the underlying concept of a question can be interesting/boring, and the votes will reflect that, regardless of the question's quality.
There can also be external factors; a post can end up linked from a blog post in which it's mentioned in a positive light; it could get a quality answer, and people are more likely to upvote a question that generates a quality answer than one that doesn't.
The quality of a question can still vary even without code. There can be great (or at least okay) questions without code, just as there can be terrible questions with/without code.
Voting cultures also change over time. One of your questions is very old, another is recent. A question might be hard to find an answer for at one point in time, but have easily accessible answer/solutions all over the place a few years later. The standards of the site even change over time. In the case of SO, they have largely gotten more and more strict.