(a)
P is C3H7COOH, the carboxylic acid. It is the only sample that gives brisk effervescence with sodium hydrogencarbonate. Carboxylic acids react with hydrogencarbonates to give carbon dioxide; alcohols and hydrocarbons do not. (It also gives hydrogen with sodium, as acids do.)
R is C4H9OH, the alcohol. It gives a gas (hydrogen) with sodium, so it contains an −OH group, but it does not react with sodium hydrogencarbonate, so it is not an acid. An alcohol behaves exactly like this.
S is C2H4. It decolourises bromine water, which shows a carbon–carbon double bond: C2H4 fits the alkene formula CnH2n and is unsaturated. Bromine adds across the double bond and is used up. It has no −OH or −COOH group, so it does not react with sodium or sodium hydrogencarbonate.
Q is C4H10. It does not react with any of the three reagents. C4H10 fits CnH2n+2, so it is a saturated hydrocarbon (butane) with only single bonds and no functional group; saturated hydrocarbons are inert to most reagents.
(b)
C3H7COOH+NaHCO3→C3H7COONa+H2O+CO2
The products are the sodium salt of the acid, water and carbon dioxide; the carbon dioxide causes the effervescence and turns lime water milky.

The reactions of ethanoic acid, all of them consequences of the —COOH group; other carboxylic acids show similar reactions.