Correct option is D
Given:
If a student studies Philosophy, they must study French.
History students cannot choose Psychology.
French students cannot study History.
French students cannot opt for Spanish.
Only History students can study Political Science.
No Psychology student has opted for Sociology.
From the given information we can deduce the following:

The only option left for a Psychology student is to take Spanish, as it does not conflict with any of the other restrictions
Thus, correct answer is (d) Spanish