たとたんに・次第・かと思ったら・かと思うと: the difference
The instant or moment, As soon as, Just as
Tested 2 times in past papers
出た途端に、雨が降り始めた。
The instant I went outside, it began to rain.
As soon as
Tested 2 times in past papers
準備が出来次第出発しますよ。
We will depart as soon as you are ready.
Then again, Just when I thought, No sooner than
ミスが続いたのであきれられたかと思ったら、そうでもなかった。
After making mistake after mistake I thought they'd be fed up with me, but they weren't.
How to tell them apart
The second part cannot be your own will, order or wish: not 「×家に帰ったかと思ったら、勉強しよう」.
「かと思うと」 stresses 'I thought A, and B overturned it at once', with dramatic surprise.
「たとたんに」 only stresses the first action as the trigger of the sudden change: 「立ち上がったとたんに、めまいがした」.
「次第」: as soon as the first is done, you do the next on purpose: 「到着次第、連絡します」 (I'll contact you as soon as I arrive).