Answer: B
Explanation: The modifier "While walking along the beach" has to be followed by the subject modified by it, which should be the same subject that performs the action inside the modifier (in this case, walking). The structure is wrong in sentence B because the subject "a huge wave" is taking the place which the modifier affects. This kind of mistake could result in ambiguity if both subjects were capable of walking, but in this case, since waves don't walk, the outcome is nonsensical.