This is something that we have been looking at, in particular for new users posting a wall of code with no context. We have added some checks to try to avoid this, such that for new users (specifically, users with low reputation), we require a nominal ratio of characters of context (i.e. non-code) per line-of-code (up to a point - obviously you can't carry that on forever, as sometimes you do need a reasonably big code sample).
Outside of that threshold, the user cannot post the question, and is asked to provide more context to explain the code. The numbers we have in place at the moment are not designed to punish / tax the asker - at current it should be exceptionally easy to pass this test as long as you have described anything about the problem - but it should cut off the WHAM! CODE! (nothing else) posts.
Note that for the purposes of this test, we do not consider the title - only the question body.
Obviously the exact numbers (and indeed algorithm) are subject to change here, as we monitor the system - but I've certainly seen plenty of new questions by new users posted since this was enabled.
Note that this check is only currently enabled on stackoverflow. It might later also serve on some other sites, but probably doesn't apply network-wide.