In the given sentence with blank no.28, the names of the students who are interested in joining the trekking trip are being collected by the teacher. Hence, the appropriate preposition which can fill the blank no. 28 is 'to'. The preposition, 'to' is used for showing who receives or experiences an action. The phrase, 'give their names to their class teacher' is correct as it shows that the teacher receives the action of 'giving the names'. Hence, option B is correct.
The preposition, 'from' indicates the point in time at which a particular process, event, or activity starts. It also indicates the origin of something. The word, 'teacher' does not indicate the origin of anything. Given these meanings, it cannot be used in the given sentence. Hence, option A is incorrect.
The preposition, 'for' means ' intended to help or benefit someone/something'. It is also used to state the purpose of an object or action. The 'giving of names does not benefit the teacher. The teacher is not the purpose of 'giving the names' either. Hence, option C is incorrect.
The preposition, 'on' means ' physically in contact with and supported by (a surface)'. Given this meaning, this preposition is not appropriate to fill the blank no. 28. Hence, option D is incorrect.