The correct option is B (III),(IV)
SOCl2 and COCl2 both replace OH of alcohols by SN1 mechanism. They coordinate to the alcohol, with loss of HCl and formation of a good leaving group (“chlorosulfite”). But when pyridine (nucleophile) is present, it can attack the chlorosulfite, displacing chloride ion and forming a charged intermediate. Now, if the leaving group departs, forming a carbocation, there’s no lone pair nearby on the same face that can attack. So chloride attacks the carbon from the backside, leading to inversion of configuration and formation of a C−Cl bond. This proceeds in the SN2 reaction.