Final answer:
Type II alveolar cells secrete surfactant to reduce alveolar surface tension preventing alveolar collapse, while alveolar macrophages remove pathogens and debris to maintain clear alveoli.
Step-by-step explanation:
The function of type II alveolar cells in the walls of the alveoli is to secrete surfactant. This substance is important for reducing the surface tension of the alveoli, which is crucial for preventing the alveoli from collapsing during exhalation. It is composed of phospholipids and proteins that mix with the water lining the alveoli to help reduce this surface tension.
The role of alveolar macrophages, another cell found in the alveolar wall, is to remove pathogens and debris. These cells roam around the alveoli, acting as a phagocytic defense within the immune system, ensuring clear and infection-free alveoli for efficient gas exchange.