The correct option is D No sooner had they gone to sleep than the alarm started ringing.
If the second event occurs immediately after the first, no sooner...than is used to express such situations. In such a structure, no sooner introduces the event that occurred first. No sooner is followed with the past tense. Option C is correct as no sooner is followed by past form 'had'. Options D is grammatically wrong as 'then' is used with no sooner. Option B is wrong as 'but' cannot be used with no sooner.