
The answer is the first one.

Bob should compute yA to the xB power modulo q.

The second one would compute the same thing.

This is in fact exactly what Alice computed,

but Bob can't do this because he doesn't know xA.

The third one wouldn't compute the same key,

so the correctness property is that Alice and Bob obtain the same key,

and we can show this by just plugging in the values.

The key Alice computed was yB to the xA.

The value of yB is g to the xB, so that's equivalent

to g to the xB xA mod q.

The key that Bob would computeand we'll write that as key BA

since we haven't yet shown that they're equivalent using this equation.

Well, yA is g to the xA, so this is g to the xA xB mod q.

And we already showed that powers of powers are commutative,

so these two are equivalent.