2g AgCl is obtainded by adding an excess of AgNO3 solution to a solution containing 1g of a mixture of NaCl and KCl.What is the ratio of moles of two salts in the mixture?

Two equations in two unknowns. Solve the two simultaneously.

Let X = g NaCl
and Y = g KCl
equation 1 is X + Y = 1 g

Equation 2 comes here. mm stands for molar mass.
X(mm AgCl/mm NaCl) + Y(mm AgCl/mm KCl) = 2 g

Solve for X and Y in grams NaCl and grams KCl.
Then convert g each to mols and calculate the ratio mols one to the other. Post your work if you get stuck.