Caulks come in a wide variety of types. Before purchasing one, read the label to be sure it is suitable for the material to be sealed. Some can not be painted, and others are only for inside use. An important consideration in selecting a caulk is life expectancy; some last only a few years while others last 20 years or more. Since this is probably not a job you will want to repeat regularly, buy long-life products.
There are three main categories of caulks, and their prices are directly proportional to their life expectancy. As shown here, the least expensive, oil based, has the shortest life. It works on all household surfaces, but over time, the oil seeps out and may stain surrounding materials.
Butyl rubber, latex and acrylic caulks last almost 10 times longer. Latex is restricted to indoor use unless painted and because it is water soluble, should not be used where it can become wet. Acrylic is durable and fast-curing, but can not be painted. Butyl rubber is water resistant, needs no paint, but may take over a week to cure.
Silicone caulks are usually your best choice. They last 20 years or more and can be used inside or out, however, they do not adhere well to painted surfaces.
Foam sealants like polyurethane are not true caulks but are excellent for filling large cracks. In new construction or when adding on, seal openings around pipes and wiring before the walls are sealed (which would then conceal the cracks.)