Hydrogen is tested for with a lit splint. Collect the gas in a test tube, then hold a lit splint at the mouth of the tube. If the gas is hydrogen, you hear a squeaky pop. The pop happens because hydrogen burns rapidly with oxygen from the air to form water.
Carbon dioxide is tested for with limewater, which is a clear, colourless solution of calcium hydroxide. Bubble the gas through limewater. If the gas is carbon dioxide, the limewater turns cloudy, which is also described as turning milky.
These tests are useful for the gases made when acids react. A metal reacting with an acid gives off hydrogen. A metal carbonate reacting with an acid gives off carbon dioxide. A delivery tube can carry the gas from the reaction into the limewater.