The criteria could be the execution of the code, programming style or passing some user defined test cases.
I see what you mean although a teacher correcting the code does not really know if the code actually works or not and it is not a viable option to execute all the programs. An automatic evaluation engine would reduce the correction part and possibly be uniform?