I once wrote a computer virus in my Computer Science 2 class in high school. It was written and compiled in QBasic of all things, on a Mac Classic.
It was pretty cool actually... if you dropped my "virus" program in the same folder as QBasic, it would launch my program instead of QBasic itself. It was a real mean bastard, too... It showed a "Welcome to TurboVirus 1.0!" message when the students opened their program, and "asked" the user if they wanted to delete their program. It didn't matter what they chose, though, since I deleted it anyway 🙂
I think that the teacher was pretty impressed with the program, but gave me detention for it anyway.