$4.00\; g$ of $NaOH$ are dissolved in $18\;g$ water.
What is the molar fraction of $NaOH$, $H_2O$?
$n_{NaOH}$ $=$ $\frac{m_{NaOH}}{M_{NaOH}}$ $=$ $0.100\;mol$
$n_{H_2O}$ $=$ $\frac{m_{H_2O}}{M_{H_2O}}$ $=$ $1.00\;mol$
$X_{NaOH}$ $=$ $\frac{n_{NaOH}}{n_{H_2O}+n_{NaOH}}$ $=$ $0.091$
$X_{H_2O}$ $=$ $\frac{n_{H_O}}{n_{H_2O}+n_{NaOH}}$ $=$ $0.909$
Comment:
This result is quite evident, because
$X_{H_2O}+X_{NaOH}$ $=$ $\frac{n_{H_O}}{n_{H_2O}+n_{NaOH}}+\frac{n_{NaOH}}{n_{H_2O}+n_{NaOH}}$ $=$ $1$
The sum of all mole fractions is unity!