The correct option is
D had taken place
In order to fill in the blank with the correct form of the verb, we must understand the tense of the sentence.In the given sentence, the word 'visited' explains to us that the act was completed in the past. As there are two clauses in the sentence, and the first clause is in simple past tense, the second clause is bound to be in past perfect tense. There are two actions in the given sentence, the second clause is the action that happened before the action in the first clause. Hence, we will use past perfect tense for the second half of the sentence.
NOTE: Different tenses in a sentence explain us the sequence of the actions.
Option A - 'Took place', is a verb in past form of the verb 'take'. As we need to fill in the blank with the past perfect tense, we need a helping verb in the past tense along with the verb in the past participle form. Hence, option A is incorrect.
Option B - 'Were taken place' is simple past tense and hence we can't use it here. If we fill in the blank with simple past tense, there will be no sequences of actions. Also, as the action in the second clause is done before the first clause, we must use past perfect tense. Hence, option B is incorrect.
Option C - 'Have taken place', is present perfect tense. As explained above, we need the verb in past perfect tense. Hence, option C is incorrect.
Option D - 'Had taken place' can be used here, as the past participle form of the verb (taken) is used with a helping verb (had) to form past perfect tense. Hence, option D is the correct answer.
'When Shashi visited his school three years ago, he found that a lot of changes had taken place.'