Hardly . . . . . . . . left the railway station when the train arrived.

he
did he
he had
had he

The correct answer is (A).

The sentence is in the past perfect tense, which is used to talk about an event that happened before another event in the past. In this case, the event that happened before the train arrived is that the man left the railway station. The past perfect tense is formed with the past participle of the verb (left) and the auxiliary verb had.

The other options are incorrect because they do not agree with the tense of the sentence. Option (B), did he, is in the simple past tense. Option (C), he had, is also in the past perfect tense, but it is used with a different meaning. Option (D), had he, is in the past perfect subjunctive, which is used to talk about a hypothetical situation.

Here is a diagram that shows the tenses of the verbs in the sentence:

Tense | Verb | Meaning
——- | ——– | ——–
Past perfect | left | The man left the railway station before the train arrived.
Simple past | arrived | The train arrived.

I hope this explanation is helpful! Let me know if you have any other questions.