The correct option is D It had rained heavily for several hours and the streets were very wet.
The tense of a sentence denotes a time, whether it is the time now (present), time then (past) or the time to come (future). The verb of a sentence has most to do with the tense. The past perfect continuous tense describes an action which began in the past and continued up to a certain point of time in the past, example, 'I had been practicing my dance steps when I got a call from work'. The tense has the form had been + present participle (verb + ing), this form is used in a positive sentence of this tense, as seen in option C. We need to choose an option that isn't in this tense form, hence C is incorrect. In interrogative sentences, the form changes slightly, the subject and the first helping verb 'had' interchange their positions, such that the helping verb comes first and the subject comes second. This can be seen in options A and B, had + Sam and John/you + been +cheating/waiting, we can't choose these options, as they are in the continuous tense form, hence options A and B are incorrect. The tense in option D is in the past perfect tense, as it's of the form had + past participle (verb + ed) 'had rained'. It refers to an action that got completed in the past, it's not in the past perfect continuous form, hence option D is correct.