The reason a gas exerts pressure on its container is that the molecules of the gas collide with the walls of the container. When gas molecules are moving around, they hit the walls of their container, which creates a force on the walls, and this force per unit area is defined as pressure. The more molecules there are in the container, the more collisions there will be, and therefore the greater the pressure exerted by the gas. So, the correct option is "the molecules of a gas collide with the walls of the container".