Removing the lens doesn't fog film in the camera because the shutter is directly in front of the film. It remains closed until the shutter release button is pressed. Shutter-priority automatic exposure adjusts the lens opening while you set the shutter speed. The aperture selected by the camera is displayed in the camera viewfinder. Programmed automatic exposure sets both the shutter speed and lens opening automatically.
Some cameras have two or more exposure programs.
For example, there may be a 'normal' program, another one that selects the fastest shutter speed possible to stop moving subjects and a third program that increases depth of field by stopping down the lens opening more than normal. Multi-mode cameras allow you to choose from two or more methods of exposure control. They usually are more expensive than simpler cameras, but offer the most versatility.