Step 1: Recall the formula of each mineral.
Magnesite is \(MgCO_3\), it has only magnesium. Calcite is \(CaCO_3\), it has only calcium. Carnallite is \(KCl \cdot MgCl_2 \cdot 6H_2O\), it has potassium and magnesium, no calcium. Dolomite is \(CaMg(CO_3)_2\), it clearly has both calcium and magnesium in the same formula.
Step 2: Match with the question.
The question asks for a mineral with both magnesium and calcium together. Only dolomite fits this description.
So option D, Dolomite, is correct.
Why the others are wrong: Magnesite and calcite each contain only one of the two metals. Carnallite contains magnesium but not calcium, it has potassium instead. None of these three satisfy the condition of having both metals.