Television was invented in the 20th century. It presents a past action.
Option D: 'When was...invented?' is in simple past tense in passive voice. The sentence is in passive voice since the subject 'television' experiences the action 'was invented'.
The sentence is complete and meaningful, hence option D is correct.
Option A: 'When television was invented' is not in the correct word order.
The correct word order for an interrogative sentence in the simple past tense (passive voice) is:
'Question word (when) + helping verb (was) + subject (television) + main verb (invented)?'
Option B: 'Had television invented' is in active voice. It states an action performed by the subject 'television'.
Option C: 'When ... had been invented' is in past perfect tense. Also, the words are not in order.
Hence options A, B and C are wrong.