Asking it as a "trick", where you pretend it is a real question and you don't know the answer, could certainly be annoying depending on the professor's mood. So don't try to be tricky.
Hi Professor, if you have a few minutes, I came across an interesting puzzle that I thought you might appreciate. [if invited to continue:] Look at this program; can you guess what it would output?