Approach this by asking which organism in the list produces tissue necrosis severe enough to leave an air-containing cavity on imaging. Cavitation requires destruction of lung parenchyma followed by drainage of the necrotic material into an airway.
Reactivation pulmonary tuberculosis is the prototype: caseating granulomatous inflammation undergoes central liquefactive necrosis, the softened caseum empties through a bronchus, and a persistent thick-walled cavity (typically in the apical or posterior segments of the upper lobe) results. This is the single most exam-classic answer for lung cavitation.
Comparing the distractors: Mycoplasma drives an atypical interstitial pneumonia with no cavitation; pneumococcal (streptococcal) lobar pneumonia gives dense homogeneous consolidation that resolves without cavity formation; Staphylococcus aureus can cavitate and form pneumatoceles but is the secondary, not the textbook, choice here.
The printed recall key (Streptococcal pneumonia) conflicts with this physiology, since the pneumococcus is a non-cavitating organism, so the medically correct selection is Tuberculous pneumonia.
\[\boxed{\text{Tuberculous pneumonia}}\]