Teacher: At the end of this ruler is an idiot.
Student: Which end?
Teacher: At the end of this ruler is an idiot.
Student: Which end?
The joke plays on the double meaning of "at the end of the ruler". The teacher implies the idiot is figuratively at the end, but the student pretends the idiot is literally at one of the two physical ends of the ruler, implying the teacher might be the idiot.