Pneumonia can be caused by two most common causative agents namely- Streptococcus pneumoniae and Haemophilus influenzae.
Every disease has a different mode of infection, a person can acquire pneumonia caused by these microbes by inhaling the droplets/aerosols released by an infected person during coughing and sneezing and can also be transmitted by sharing utensils like glasses, plates with an infected person.