I've heard of teachers using resources on the internet, but for the most part it's still starts as a judgement call. It's actually pretty easy most of the time to tell if a student understands what they're writing or is simply cutting and pasting.
There is a free program available to instructors, on the internet. It is called MOSS for Measure of Software Similarity. Registering for Moss Moss is being provided in the hope that it will benefit the educational community. Moss is fast, easy to use, and free. Access to Moss is restricted to instructors and staff of programming courses. To obtain a Moss account, send a request to moss-request@cs.berkeley.edu. Processing requests for accounts may take up to a day; once you have an account queries are processed as soon as they are received.