The opportunity cost is equivalent to the benefits of the alternative we do not take.
If we have two proyects A and B (and a resource constraint, so we can't do both), and we implement A because it has a better rate of return, the rate of return of B is the opportunity cost.
In the examples given, the only one that represents an opportunity cost is Example B. In this case, the benefits of having headphones is the opportunity cost, as it is what we don't get for the choice of buying the laptop instead of the headphones.