An action in a sentence can be represented in two ways, namely active and passive voice.
The passive voice always uses the past participle form of the main verb irrespective of any tense. Only the auxiliary verbs depend upon the sentence given in the active voice.
The correct answer is C)The teacher punished the boys who had not done their homework.
Option C is correct as the subject of the given sentence (teacher) comes in the place of the object(the boys). Here, 'who had not done their homework' gives an indication of which group of boys the teacher punished. Also, the past participle form of the main verb with the helping verb 'was' is used.
Options A,B, and D are wrong as the given sentence is not in the past perfect tense, the phrase 'who had not done their homework' is placed wrong, and the given sentence is not in the past continuous tense respectively.