Answer:
Friction acts in the opposite direction to the motion of the truck and box.
Explanation:
Let's first review the problem.
A moving truck applies the brakes, and a box on it does not slip.
Now when the truck is applying brakes, only it itself is being slowed down. Since the box is slowing down with the truck, we can conclude that it is friction that slows it down.
The box in the question tries to maintains its velocity forward when the brakes are applied. We can think of this as the box exerting a positive force relative to the truck when the brakes are applied. When we imagine this, we can also figure out where the static friction will act to stop this positive force. Friction will act in the negative direction. Or in other words, friction will act in the opposite direction to the motion of the truck and box. This explains why the box slows down with the truck, as friction acts to stop its motion.