The only way I think that would happen would be if they were fairly weak to begin with and had a ton of performance anxiety, but I'd expect that to be exceptionally rare.
You could maybe pass the intro to CS class (mostly theory, not much programming), but unless you were willing to pay someone else to take tests for you there is absolutely no way you'd make it through data structures, or algorithms.
Even in an intro to MATLAB class I took that was designed primarily for non CS majors (mostly physics and biology majors) that substandard level of programming would have resulted in an F.
If one knows they will get zero if it does not compile (and they make this clear in the course), then I would be doing everything to remove code until it does compile and hope for some points versus none. I've seen some of the code snippets and it's just as bad as one would think. One person even wrote rude output statements when a user entered the wrong info (i.e. calling the person an "idiot" and such). Ironically, this person's code also did not compile.