The correct answer is B. to.
The word “junior” means “lower in rank or position”. In the context of the question, the speaker is saying that they are lower in rank or position than their friend in the office. The word “to” is the most logical preposition to use in this sentence, as it indicates that the speaker is subordinate to their friend.
The other options are not as logical. The word “by” could be used to indicate that the speaker is being supervised by their friend, but this is not the meaning that is intended in the question. The word “of” could be used to indicate that the speaker is a member of the same group as their friend, but this is also not the meaning that is intended. The word “for” could be used to indicate that the speaker is working for their friend, but this is also not the meaning that is intended.
Therefore, the correct answer is B. to.