John said to me, “where have you been last night?”

John asked me where had I been the previous night.
John asked me where I have been the previous night.
John asked me where I am the previous night.
John asked me where I had been the previous night.

The correct answer is: A. John asked me where had I been the previous night.

The sentence “where have you been last night?” is in the past tense, so it is asking about a past event. The answer to this question would be a location that the speaker was at the previous night.

Option B is incorrect because it uses the present tense “have been.” The present tense is used to talk about things that are happening now or that happen regularly. In this case, the speaker is asking about something that happened in the past, so the present tense is not appropriate.

Option C is incorrect because it uses the present tense “am.” The present tense is used to talk about things that are happening now or that happen regularly. In this case, the speaker is asking about something that happened in the past, so the present tense is not appropriate.

Option D is incorrect because it uses the past perfect tense “had been.” The past perfect tense is used to talk about things that happened before another event in the past. In this case, the speaker is not asking about something that happened before another event in the past, so the past perfect tense is not appropriate.