For a simple assignment, writing code that would allow one computer to visit web pages located on another, two students in H. E. Dunsmore’s class at Purdue University turned in nearly 100 identical lines of code. Was it a fluke? Or had they cheated?

As he looked over their work, Mr. Dunsmore, a veteran computer science professor, saw what he called the smoking gun:

boolean done = true;

while (!done) {

Because they had written !done — the exclamation point means “not” — the program translated it as “not true,” which made the program ignore the code that followed, causing it to fail. In a class of about 450, they were the only ones who made that fatal mistake.

“This is pretty strong evidence that one had copied the other,” Mr. Dunsmore said. “They later both confessed to collusion.”

College students have flooded into computer science courses across the country, recognizing them as an entree to coveted jobs at companies like Facebook and Google, not to mention the big prize: a start-up worth millions.