This question is an Apprentice-level, two-segment motion. There is the eastward movement followed by the westward movement. When it comes to the direction-ignorant distance quantity, these directions do not matter. Simply add up the length of the two distance segments and you have calculated the amount of ground that is covered.
The quantity displacement is a direction-conscious quantity. Direction matters! The eastward movement of motion takes the dog away from the starting position. But the westward movement negates this motion and takes the dog back past the starting point to the westward side of the starting position. Because the second movement is in the opposite direction as the first segment, one must subtract this from the length of the first movement.
A common approach for questions like these involves defining East as the positive direction and West as the negative direction. A 16-meter westward segment is thought of as a -16 m displacement. The overall displacement is the sum of the positive (East) and negative (West) movements. If the sum turns out to be negative, then the direction is opposite of East; that is, it would be West.
Finally, as questions like these become more difficult (as in the 3-segment "Master" level and 4-segment "Wizard" level questions), it becomes useful to diagram the situation. Draw an arrow for each segment of the motion; and draw the arrow in the described direction and approximately the relative length. Where one arrow ends, the next arrow begins. The process of diagramming helps a learner to visualize displacement as the overall change in position relative to the starting position.