from your last question and this one, I think you are studying that part of G chemistry that talks about the " salts dissolve in water and give Basic or acid to the solution" .
first correct your formula: Mg(Cl)2 is correct not MgCl
it is very easy follow me:
1-for each salt you have one cation and one anion for example for this question you will have Mg+2 as cation and Cl- as an anion.
2- add OH- to your cation and H+ to your anion then you will have
Mg(OH)2 base
HCl Acid
3- compare those two which one is stronger and which one is weaker( acidic and basic) in simple words ask yourself HCl is strong acid or weak acid and same question about basic for Mg(OH)2, then stronger will dominate for this question I think both are strong and it will be natural
but for your another question(NaHCO3) for sure is basic
NaOH strong Base
H2CO3 weak Acid
just remeber solution will be weak(base or Acid)
hope it helped
🙂