In P (program) mode, the camera automatically selects the aperture and shutter speed depending on the lighting conditions. Every camera is programmed to do this. The camera takes a meter reading from the scene, assigns an exposure value and selects predefined shutter speed and aperture. Read more about P mode