This GMAT math practice question is a sampling with replacement question in Permutation and Combination.
Sampling with replacement
The first letter can be posted in any of the 3 post boxes. Therefore, we have 3 possibilities.
Similarly, the second, the third, the fourth and the fifth letter can each be posted in any of the 3 post boxes.
Each of the 5 letters has 3 possibilities because we can post any number of letters in all of the boxes.
Therefore, the total number of ways the 5 letters can be posted in 3 boxes is 3 * 3 * 3 * 3 * 3 = 35
Choice D is the correct answer.