My answer is different to the others, though I don't think their definitions of opportunity cost are incorrect, only their interpretations of the problem. But based on my interpretation of your question, I would indeed say that the opportunity cost of activity B is $150.
This is a trick question because it is playing on the differences between economics and math and misleading wording, making it an ambiguous scenario leading to different assumptions/interpretations of the underlying circumstances. This ambiguity means that some clarifications and assumptions need to be made to answer the question.
In reality, a gain of -$50 does not make sense on its own, because there is no such thing as negative money. Opportunity cost only makes sense when there is a choice in the first place, and choosing to lose \$50 to perform some activity is the very definition of a cost. A net gain (or profit) of -\$50 can make sense, but that implies more than one factor. In a situation where you pay \$50 and get \$0 back, that is a cost of \$50 and an output of \$0. This is often the case when you spend money for immaterial gains, such as entertainment.
With that out of the way, there are 3 assumptions that need to be made to answer the question:
Assumption 1: You can only choose activity A OR activity B, but not both. If you could choose to both, then the opportunity costs would not depend on each other as you are not foregoing either option by choosing the other one.
Assumption 2: We are evaluating the opportunity cost of the output of partaking in activity B, and are not differentiating between gaining the right to partake in an activity, with actually partaking in it. This is an important distinction, because if we are discussing gaining rights to perform the activities, then gaining the right to activity B over activity A would trivially have an opportunity cost of $100, because you could then choose to not partake in activity B, and you would have lost no money. However, partaking in activity B would then have a further opportunity cost.
Assumption 3: Activity B has a cost of \$50 and an output of \$0. This is important because we are evaluating the opportunity cost of the output, so the cost needs to be differentiated from the output. If you buy a \$50 bill for \$100, you would say that the \$50 bill cost you \$100, not \$50, but your net gain (or profit) was -\$50. This is clearly different from the situation where you pay $50 for entertainment, even though the net gain is the same.
With these 3 assumptions the answer becomes clear, that the opportunity cost in partaking in activity B is \$150. The opportunity cost is equal to the potential $100 you could have gained from partaking in activity A (implicit cost), plus the explicit cost of \$50 from partaking in activity B.
As an equation, we can say that:
Net gain compared to best alternative(B) = Output(B) - Opportunity Cost(B)
Opportunity Cost(B) = Output(B) - Net gain compared to best alternative(B)
Opportunity Cost(B) = \$0 - (Net gain(B) - Net gain(A))
Opportunity Cost(B) = \$0 - (-\$50 - \$100)
Opportunity Cost(B) = \$150
Side note: "Net gain compared to best alternative(x)" is only positive when x will give the most net gain. That also means that the opportunity cost of x will always be greater than the output of x unless x gives the most net gain. This intuitively makes sense, because if the output of an option is greater than its opportunity cost, this means the value we get from this option is greater the value we are foregoing by picking the next best option.