I would occasionally bury stuff in programs that shouldn't have been there. I was afraid that the teacher might look at my programs and if there was a functional program, would realize what I was doing, so I'd usually have a code language that I could easily decipher but wouldn't be easily figured out by someone else.
I probably gave my teachers too much credit, but the classes that could use calculators were usually taught by teachers who knew about programming the things.
Chances are, if you were able to program the algorithms required to solve the problems, you understood them well enough or more than enough to pass the course.
Definitely not the case for me. I had as many books and websites as I needed while creating those programs, but did not have them available during tests.
I probably gave my teachers too much credit, but the classes that could use calculators were usually taught by teachers who knew about programming the things.