Elements that are positioned in the same column (or group) of the periodic table exhibit similar properties. This is due to the similar electronic configuration (more importantly the number of valence electrons).
Among the two groups given here, choice (b) Mg, Sr and Ba are alkaline earth elements (part of group IIA) in the periodic table. Other elements of this group are Be, Ca and Ra. All these elements form the alkaline earth metal group of the periodic table. All these elements have 2 valence electrons, which they can give up to attain a +2 charge as cations. They have certain common properties, including shiny and silver-white appearance.
In comparison, the choice (a) consists of elements Cd, Ca and C which are part of different groups. Ca is from group IIA, Cd is from group 12 and C is from group VI and hence have different properties.
Hope this helps.