This is a third conditional (past unreal). The structure is 'If + past perfect, ... would + have + past participle.' 'Had studied' describes the unfulfilled past condition, and 'would have passed' describes the hypothetical past result. Option B is the only grammatically correct choice.