I caught a student plagiarizing on a programming assignment by copying someone else's code and replacing some variable/function names. I gave the student a zero, and shortly afterward he emailed me maintaining that he's innocent and I'm falsely accusing him of cheating.

What should I do?

  • 48
    I got falsely accused of plagarism by a CS prof in college. I turned in an assignment that was identical to another student's assignment. Down to the variable names. The catch is that completing the assignment was about 50 LOC and the variable names were pretty obvious given the problem domain. I assume the assignment was non-trivial? Or is there a decent possibility that two students came up with almost identical solutions? Nov 4, 2015 at 2:11
  • 10
    How did you catch him? Is it without a doubt an infallible claim that he plagiarized? Can you present him with this evidence?
    – Octopus
    Nov 4, 2015 at 3:03
  • 11
    @corsiKa When I studied Physics in Germany copying homework was usually tolerated, with similarly lax punishments. The logic was that homework only serves to prepare the student for the exam, and copying the homework means that you at least looked at it, which is still better than not doing it at all. Some mathematicians even divided the total points by the number of students with identical solutions and gave each that partial credit. Nov 4, 2015 at 7:59
  • 31
    The "I suspect of having plagiarized" in your title is at odds with the "caught a student plagiarizing" in your body text. If you have no evidence (i.e. lengthy comments copied verbatim?) and did not catch the student red-handed, you cannot do anything. Innocent until proven guilty.
    – Moriarty
    Nov 4, 2015 at 8:23
  • 10
    @Nelson The number of bracket styles and indentation styles is limited. Moreover in some languages there are strong preferences towards certain particular styles, and even about naming of functions/variables etc. In other words: chances of producing the same 50 loc program are actually pretty high.
    – Bakuriu
    Nov 4, 2015 at 14:40

12 Answers 12


Inform the student of the school's official procedure for appealing an accusation of plagiarism, and suggest he follow that procedure. (Also see: How can I prove that I didn't plagiarize.)

Policies and procedures are there exactly for situations like this one.

Generally if the student chooses to appeal, the procedures involve other parties (a dean, or a committee dedicated to such matters, for example) evaluating the student's side of things and your side of things (your reasons for believing that the student plagiarized) and then deciding on next steps according to school policies. (Here's an example.) So if you think the student is likely to appeal, you can start to prepare your side of things - the "evidence" - in the meantime. (Personally, when in this situation I also like to let the department head know that this appeal might be coming.)

Note that you don't need to have caught the student on videotape, or anything like that. You'll tell the committee what you know, they'll make the decision as to whether it's enough evidence, and they'll make the decision as to whether the consequences you have imposed should stand. Deciding whether your evidence meets "standards of proof" for an appeal according to school policy is their job, not yours (they have much more experience than you in this matter.) Assuming you made your accusation in good faith, you don't need more evidence for an appeal than you did for the original accusation.

  • 6
    By the same token, the OP should then look into what he needs to do to defend his claim of plagiarism/cheating, should it be formally contested. I would expect that "oddly similar to" is not an adequate standard of proof, though a preponderance of circumstantial evidence may suffice. If you had a TA there who also witnessed the behavior, or if the student cheated off of is willing to testify about the behavior, etc. you may need to produce this for a formal inquiry. Nov 4, 2015 at 2:12
  • 13
    Policies and procedures are there exactly for situations like this one. Well, I think you put a bit too much faith in policies and procedures. The fact is people sometimes get wrongly accused of cheating, and the committee will not always save them, so the OP is quite reasonable to be concerned about how to proceed. However I agree with everything else you wrote - great answer and +1.
    – Dan Romik
    Nov 4, 2015 at 5:35
  • 3
    @zibadawatimmy I never made a claim that she (ff524) made a claim about the infallibility of the system. (And yes, feel free to reply that you never made a claim that I made a claim that she made a claim, etc.) However, it is true that I think ff524's answer seems to put a bit too much trust in the system working as it should. Note that OP is wrestling with a question of conscience: should he proceed with punishing a student who protests his innocence? ff524 essentially says: follow your instinct, and let the system do its thing. ...
    – Dan Romik
    Nov 4, 2015 at 7:28
  • 10
    ...(continued) I generally agree with this advice, but I was trying to emphasize that OP as the accuser still has a responsibility to make sure his accusations are standing on firm moral ground; the fact that a committee will review the claims does not absolve him of a duty to be very careful. This is all the more true in a world in which committees are fallible, and would be less true if all committees were guaranteed to be made up of amazingly professional and reliable people, which they aren't.
    – Dan Romik
    Nov 4, 2015 at 7:28
  • 2
    Sounds very much like the American legal system. If you plead guilty you get a small punishment. If you go to court and lose you get a huge punishment, so going to court is not a better idea even if you'd win with high probability. Nov 4, 2015 at 8:01

In my first college programming class (Pascal) after the midterm another student and I were called in to meet with the professor and the Dean. We were accused of plagiarism. The other student was a girl from a mid-eastern country, conservative, scarves, etc. She completely broke down crying. While she cried, I assured the professor that she and I had literally never even spoken to each other. He then showed me the programs that she and I had written. They were almost perfectly identical, even to variable names. My academic career on the line, I suggested that he give each of us another programming challenge, and see what happens; that perhaps we just have similar programming styles. He did so, and he watched me while the Dean watched her in a separate room. We both completed the task within a minute of each other (I know because we all showed up at the printer at the same time).

Again, our programs were almost entirely identical. I think all but one of our variables had the same name. She and I were two of the best programmers in the class, and apparently we just wrote programs very similarly. We actually ended up having the professor inform the rest of the department, so we wouldn't have the same problem in future classes.

  • 7
    Great story! It seems that there may be a real epidemic of instructors falsely accusing programming students of plagiarism based on purely coincidental code similarities. A scary thought, and I'm happy this question creates a record of several such stories that future falsely accused students may be able to find and refer to.
    – Dan Romik
    Nov 5, 2015 at 18:12
  • 2
    @DanRomik And, though not applicable in this case, it's entirely reasonable that students in a curriculum may have legitimately worked on group projects in earlier classes together, and have developed similar coding styles. That's usually a good thing for professional coders; I've heard it said that in a good team with good coding conventions, one person's code shouldn't be distinguishable from another's. (In a senior level course, another student and I used to compare our independently written programs to ensure that they were different enough to not trip naive similarity tests. Nov 6, 2015 at 13:19
  • That's interesting! I've compared many, many student assignments and never seen any case where there was such similarity and there was no plagiarism. Good to keep in mind, especially with the better students!
    – Peter K.
    Nov 6, 2015 at 15:15
  • 1
    Because computer languages are far more constrained in their grammar and usage than natural languages, the tendency towards similarity is much higher. For many tasks, there are very specific steps that have to be performed for correct completion of the task, and especially for smaller more trivial programs, the possibility for high similarity is there. Nov 10, 2015 at 19:42

The title of your question does not match its content, since they are each asking different things. The title asks:

What to do about a student whom I suspect plagiarized but claims not to have?

If you suspect that a student plagiarized, you should investigate the matter further to see if you can come up with solid evidence. The student should be punished (with a failing grade and/or reporting to your university's student judicial affairs or equivalent unit) if, and only if, the evidence points to the student's guilt with a reasonably high degree of certainty.

Given that you already decided to give the student a zero grade for the assignment, and that suspicion alone does not merit such punishment, you should reverse the decision and grade the student's assignment as if he had done it himself. It may be appropriate to nonetheless tell the student that you have suspicions that he plagiarized the assignment, and give him a stern warning that from now on you'll be watching his every move and that he should not try to play any more such games.

On the other hand, the body of your question tells a different story:

I caught a student plagiarizing on a programming assignment by copying someone else's code [...] What should I do?

This is substantially different from what the title was asking. If you don't just suspect the student plagiarized but believe you "caught the student plagiarizing", i.e., you have what you consider to be solid evidence and are willing to defend your accusation in the event that the student challenges it, then you may consider your decision to have been an appropriate one. In that case, ff524's answer gives very good advice about how to proceed. However, I would strongly caution you that we humans are fallible beings, and in particular we have a distinct tendency to be overconfident of our own judgments. This overconfidence is known as the illusion of validity (described here, and more in detail in this wonderful article by Daniel Kahneman, the behavioral economist who coined the term).

I saw this effect with my own eyes in a plagiarism case I was involved with at my university, in which an instructor suspected two of his students had shared code because the plagiarism-detection software he used flagged their code as having a high similarity score. As an objective party who inspected the two students' code (and being more than knowledgeable enough about the programming aspects of the case), I was far from convinced that any of them had committed plagiarism, and after also interviewing the students I was close to 100% certain that they hadn't. Nonetheless, throughout this process the instructor who had accused them of plagiarism (a very smart and accomplished computer scientist) remained adamant, quite bizarrely in my opinion, that some misconduct must have occurred.

The bottom line is that your decision to punish the student should be based on more than just your own feeling of confidence that your suspicion is founded, since such feelings have been scientifically shown (by Kahneman, who won the Nobel prize for such work, and others) to be extremely inaccurate. If that means letting a potential cheater go unpunished, that may be annoying but it is still much better than punishing someone for an offense they did not commit.

  • 21
    Ugh, plagiarism detection software. Any instructor who uses it should be forced to put all of their own publications through it, just to see how "useful" a "similarity score" is.
    – ff524
    Nov 4, 2015 at 5:27
  • 3
    @ff524 I never used such software myself but I believe it has its uses. However, one should know how to interpret its output since invariably there will be many false positives, which is something the instructor in question was not good at recognizing.
    – Dan Romik
    Nov 4, 2015 at 5:41
  • 1
    @ff524 I always wondered why plagiarism detection software don't use tried and tested statistical methods of p-value based detection, much like what BLAST does for hits in its database. A mere %ident doesn't really say much in the absence of other information.
    – March Ho
    Nov 4, 2015 at 12:38
  • 7
    "reverse the decision and grade the student's assignment" - not needed. If it's indeed identical by coincidence, it deserves the same grade. Side benefit: this helps you step over feelings that may unduly influence your grading.
    – MSalters
    Nov 4, 2015 at 14:21
  • @MarchHo: I don't think anything short of blatant copy/pasting is going to give you alpha < 0.05, which means you'll still have instructors applying punishments with alpha > 0.05, or you will have students "getting away with it."
    – Kevin
    Nov 5, 2015 at 23:27

I would call him in and go over the assignment. Have him explain the code and the decisions he made in coming up with the code. You should be able to get a pretty good feeling from that conversation whether this was actually his code or not.

Also, is it possible that someone cheated off of him instead of the other way around?

  • 8
    Just to muddy this up a bit more, I gave up on finding out "who cheated". I realized that what I care about is that they understand what they handed in, regardless of having copied it from somewhere or written it up themselves.
    – vonbrand
    Nov 4, 2015 at 20:06

Well, this brings back something that I had long forgotten. When I was 8 years old, I was accused of 'copying' by another child and disciplined by the teacher. We both wrote about going to a circus in the snow. The fact was that there had been a circus and it snowed on one of the days. Clearly we had simply visited the same event. I was unable to convince the teacher of this and it rankled for a very long time.

If the code is messy and contains exactly the same errors in exactly the same places then maybe it was plagiarism. If however the code is optimal then it could simply be a case of convergent evolution.

I suggest caution.

P.S. How would you know which of the two was the plagiarist?

  • "If however the code is optimal then it could simply be a case of convergent evolution." I have never seen two people write code that is exactly the same except variable/function names. Number of spaces before and after "=", number of lines between variable declaration and start of code, location of parenthesis, things like that are always different. Your point abut which of the two is good though although most professors consider both cheaters, the one that allowed their to be copied is almost or just as bad.
    – Sam
    Nov 5, 2015 at 0:01
  • 4
    It depends how lengthy and complex the code is. We aren't told. Also the OP says that one student was given zero. What about the other student? I don't think there is much point in us guessing -- only the OP can fill in the details. I'm just advising caution. Maybe the student was caught red-handed stealing the code from someone's laptop. If so then the answers here are going to be different. Nov 5, 2015 at 0:13
  • 6
    @Sam: If the students both used the same IDE, and both clicked "Fix code formatting" before handing in the assignment, then things like spacing, indentation and brace placement very likely will be identical. Other things could still differ, of course, but if both students also e.g. followed the instructor's / textbook's coding style on things like variable naming and scoping, and perhaps based their overall code structure on the same examples in the textbook, then (nearly) 100% convergence is possible. Nov 5, 2015 at 14:17
  • 1
    @IlmariKaronen: Even if they didn't, while in some languages you see more acceptable styles than in others, better programmers will (by then mostly sub-consciously) use a single consistent style throughout, their choice biased by personal preferences, prior exposure and which style the template / given code followed. So no need for that auto-formatter, though it helps getting there. Nov 5, 2015 at 20:08

I'm not going to address whether or not the student is actually guilty; I will only answer regarding the procedure, which is what I understand your question is really getting at. At my university, there is a very specific procedure for professors to follow when they suspect cheating. Two relevant steps in the procedure are:

  • We need to prepare a formal case and submit it to the Dean's office. This 1) gives the student the ability to explain themselves, appeal, etc; 2) it shields professors somewhat from the emotional impact of sobbing/angry/denying/pleading/story-telling students; and 3) it protects students from unreasonable professors.

  • We are not allowed to exact any penalty on the student. The Dean's office handles this. This has two main benefits: 1) penalties can be made uniform for similar offenses by different students; and 2) repeat offenders across different classes can be identified and penalized accordingly.

I don't know what is the case in your university, but I suspect that they have a precise procedure to follow as well. Did you follow it? If you did not follow the procedure precisely, then you are making a mess for yourself. I am not assuming that it is the same as my school's procedure, but regardless of your school's specific policy, I see a major problem in your description: Students should at least have the right to explain themselves if they are accused of plagiarism (even if it is just with the professor). Apparently, you went ahead and made the decision and penalized the student without even letting them explain themselves. This is not just to the student.

I know that plagiarism is a huge hassle to handle (trust me, I have much experience in this), but we have to be just to our students and follow the policy. Perhaps you have exacted such a penalty in the past and guilty students kept quiet, but such an approach doesn't protect innocent students in case you make a mistake. They should have the right to such protection, and you should not take it away from them.

I recommend that you contact your department chair or dean's office to learn the formal procedure and then follow it.


There are two sides to the question: how can you prove that plagiarism occurred, and how is plagiarism dealt with in your institution, including the amount of evidence required and the weight of the consequences for infringement. Dan Romik raises excellent points, in that you should always err on the side of caution.

I will only focus on finding statistical, objective evidence. If, from amongst N students, student A's code is overwhelmingly similar to student B's, and other similarities form a clear gaussian, then there is

  • objective proof that the assignment was not so trivial as to only accept variants of A's answer.
  • objective proof that, among all possible student pairs, A-B merits special interest

I have seen colleagues use AC to perform this kind of analysis. Other free programs exist (although they don't go so much for the visual aspect, at least last time I checked). It appears to perform tokenization prior to comparison, so that comments, spacing, and renamed identifiers are completely ignored.

code similarity histograms

Image, from the above site, with a histogram where bars on the left represent very similar submissions, and at the right very dissimilar submissions. You can see a bell-shape to the right of the current selection; the graph display is displaying all currently-selected edges. Clicking on them would open a code-comparison window.

  • Not directly answering the question, in my opinion, but I upvote anyway for highlighting a great tool that is somewhat related.
    – Tripartio
    Nov 5, 2015 at 22:31

How many possible creative solutions exist to complete the assignment? As someone who's gone from a creative environment to a technical one, I see programming as a bit of world that goes between pure math to pure Art, and how you approach it academically really depends on the level of complexity you're trying to teach. As pointed out in the comments below, a long assignment requires so much consideration. If this is a thesis level piece that requires several pages of code, then yes, you have a case. If the assignment is short and the answer can be found in a textbook, you'll find a lot of your students will look at it, decide it is correct, and hand in some version of that code, and I think you'll be doing more of a disservice to the student by getting them expelled for that.

I have a personal case for learning by copying:

I was taught programming by a manager who fully believed in 'figuring out the solution for yourself' - his code was terrible. There was a lot of 'reinventing of the wheel' simply because he wouldn't look up common methods. After I got out from under his rock, I proceeded with the 'copy,adjust,test' method of learning, and picked up many things much faster. I found out later that what my former manager did happens often - and I've seen code get tossed because it was so full of unique methods for common tasks that it was unmanageable.

I realized that the way I learn is by reading and understanding the 'good' version of it. That's how most musicians and writers learn - we don't go to a textbook, we go to the stories and the music, and there's going to be a little 'copying' until they've been exposed to enough code to get really creative.

If you can see this happening with your assignments, you might want to make them a little broader or include a 'comments' requirement that will force them to explain how their code works.

P.S. teaching them to write comments in their code now will probably make the world run better in the long run.

  • There is a huge difference between avoiding to reinvent the wheel and plagiarism. Good programming assignments will specify to what extent you may and shall resort to existing libraries and similar. The whole point of training programming is often that you can solve programming tasks where it is impossible to resort to existing libraries (because they do not exist). Allowing the students to bypass this goal by copying everythign makes the assignment pointless and the corresponding grade meaningless. There is a difference between understanding somebody else’s code and producing your own.
    – Wrzlprmft
    Nov 4, 2015 at 21:38
  • 2
    Wait, did you really just imply that coding is not creative...?
    – Sam
    Nov 4, 2015 at 21:46
  • "so often there's really only one right or best way to achieve the goal." I assume you have never worked on a project more than 3 lines then. What is "best" or "right", fastest? lowest memory use? easiest to understand? easiest to maintain? Cheapest to produce? Least likely to fail? Engineers creatively balance all of these objectives on a daily basis.
    – Sam
    Nov 4, 2015 at 23:45
  • well, Sam, you told me! I'll edit the answer.
    – LeLetter
    Nov 5, 2015 at 0:25
  • 2
    There is also a huge difference between demonstrating your skill in writing code from scratch and producing the best code in the shortest time. Classes ask for the former, for relatively simple problems; in that context, copying other people's code is inappropriate. Companies ask for the latter, for far more complex problems; in that context, copying other people's code is effectively required.
    – JeffE
    Nov 5, 2015 at 22:06

You should reverse the decision until you can prove that the student plagiarized.

The phrase is "innocent until proven guilty" for a reason.

If you follow the current leading answer (by ff524) you have a good chance of simply bullying the student into accepting a 0. I met a lot of people through college that would rather take the hit than make a big issue of it.


It depends. Do you suspect that the student plagiarized or did you catch the student while doing so? Do you have evidence? If it is only based on a suspicion, I suggest you gather some incontrovertible evidence to support your claim before you bring the case further. If the student did plagiarize, it will not be so easy to win an appeal if you have proof to back up your claim.

  • 1
    I would hope the OP had more than just idle suspicion before giving the student a zero on the assignment.
    – ff524
    Nov 4, 2015 at 2:47
  • I hope so too, but still best to play safe and back it up with evidence.
    – David Doe
    Nov 4, 2015 at 3:14
  • It's not up to the OP to bring the case further, it's up to the student. If the student appeals, then it's up to a committee (who is much more experienced in these matters) to decide whether the OP's evidence is enough to enforce the punishment. The OP doesn't need more evidence for the student's appeal than for the original accusation.
    – ff524
    Nov 4, 2015 at 3:24
  • 1
    Unless the committee consist of professional, experienced programmers, I still think it is safe if the OP, as a subject matter expert, provides the committee with complementing evidence to ensure that the committee do come to the right conclusion. I surely hope that no committee or board will ever conclude on plagiarism unless it can be proven beyond reasonable doubt. That said, it should not be difficult to prove, with the proper programming expertise.
    – David Doe
    Nov 4, 2015 at 3:45
  • 5
    @ff524 your confidence in the committee's professionalism, much like the OP's confidence in his accusations, may be excessive IMO. As someone who sat on such committees I can tell you not all people deciding such cases are super sensible or experienced, and many will not have a technical background. Of course they will be well-intentioned and will do the best job they can, but it's still OP's responsibility not to make frivolous or unsubstantiated accusations. So, you are correct the OP doesn't need more evidence, but the evidence for the original accusation already needs to be very strong.
    – Dan Romik
    Nov 4, 2015 at 5:31

I faced this problem once. I didn't begin by confronting the student, though; I began by taking the problem to my supervisor, who pointed out that it's not very feasible to prove cheating on this kind of assignment, no matter how certain the instructor may feel about it. He advised me to just focus on the exams. He arranged for a special room for the final exam, so the suspected student could be seated well away from anyone, in a very observable position. The suspect failed the final miserably. He had some other poor grades in the class (quizzes, midterm exam), so when the weighted average was computed, he ended up getting an F in the course. A low enough grade that he had to repeat the course (because he needed it for his major). The reason I know he repeated the course: I saw him from time to time through my office window the following summer; and he ran into me once and was very bitter about having to be on campus for summer school to repeat the course.

  • Although changing the exams won't help if the assignment on which the student appears to have cheated is the final exam, or the last major programming project of the course.
    – david
    Nov 9, 2015 at 11:14
  • I don't think the OP's problem was related to the final exam. Basically, what I'm saying is that if the student isn't able to do a homework or project, it might be easier to apply an effective consequence through careful exam proctoring. Nov 9, 2015 at 18:10

If these are programming students, they will succeed or fail as a team in their future careers.

Why not get them used to this mindset by borrowing a page from the military? I'm sure many will consider this too draconian, but it will be surprisingly effective if the entire class is penalized.

If you have objective and effective criteria to identify when plagiarism has occurred (a big hurdle, I know) I see no reason why you cannot give the entire class a zero on that assignment.

This will build camaraderie among the students as they will have a common enemy (you), will encourage collaboration and teamwork since they'll have to check each other's work (to ensure that it is not too similar) and teach them to watch out for each other and become self-policing. All of these are critical for their future success as a programmer.

  • 7
    This will build camaraderie among the students as they grab their pitchforks and torches and storm the department demanding your head on a pike. And then they'll learn the value of teamwork when the department gives it to them.
    – JeffE
    Nov 5, 2015 at 21:56
  • 1
    So you accept to go to jail because your neighbour murdered his wife ? It will teach you camaraderie by making the law your common enemy. More seriously, have you actually witnessed military commanders making themselves enemies of their men ? It seems quite suicidal.
    – Quentin
    Nov 6, 2015 at 7:16
  • If I saw my neighbor in the act of murdering his wife or knew that he had plans to do so - and did nothing about it - then yes. I would expect to be deservedly sent to jail.
    – Michael J.
    Nov 6, 2015 at 16:12
  • 1
    Following your logic, and so every member of the entire class saw one student in the class cheating and did nothing about it? How are you supposed to prove that everyone witnessed the cheating? Do you seriously believe that?
    – Tripartio
    Nov 6, 2015 at 16:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .