$\ce{MgSO4}$, on reaction with $\ce{NH4OH}$ and $\ce{Na2HPO4}$, forms a white crystalline precipitate. Identify the precipitate.
My approach: I guess the white crystalline precipitate is $\ce{Mg(OH)2}$, since it is white and insoluble in water.
With $\ce{(NH4)2HPO4}$, $\ce{Mg^2+}$ forms a white, crystalline precipitate of magnesium ammonium phosphate hexahydrate:
$$\ce{Mg^2+ + HPO4^2- + NH4^+ + OH- + 5H2O \rightleftharpoons Mg(NH4)PO4 \cdot 6H2O\downarrow}$$
This is a very sensitive test for $\ce{Mg^2+}$; however, calcium, strontium, barium and other heavy metal ions also form precipitates of phosphates under these conditions. $\ce{Mg(NH4)PO4 \cdot 6H2O}$ can be distinguished by the form of its crystals when they are examined under a microscope. It forms rhombic crystals with prismatic shape, and is less microcrystalline than other earth alkali metal phosphates (sources: 1, 2).
Well, if we look at the possible compounds that can form here:
Mg(OH)2 = Insoluble, MgHPO4 = Soluble, (NH4)2SO4 = Soluble, (NH4)2HPO4 = Soluble, Na2SO4 = Soluble, NaOH = Soluble
So, it appears your guess is correct.