This analogy question tests the relationship between a glove and a hand. A glove is a piece of clothing worn to cover and protect the hand, so the relationship is item of clothing : body part it covers. Applying this to sock, a sock is worn to cover and protect the foot, making (B) foot the correct answer.
Option (A) shoe is incorrect because a shoe is another clothing item, not a body part.
Option (C) head is unrelated, as socks are not worn on the head.
Option (D) leg is close but imprecise, as a sock primarily covers the foot, not the entire leg. The precise analogy is glove : hand :: sock : foot.