To answer these questions we use the formula
$\dfrac{\text{mass of substance (in grams)}}{\text{molecular weight}} = \text{number of moles}$.
a)
Glucose has a molecular weight of $\var{glucose}$. How many moles of glucose are there in $\var{5 * a}$ grams?
Solution:
Putting our numbers into the formula we find that there are
$\begin{align} \dfrac{\var{5 * a}}{\var{glucose}} &= \var{(5 * a) / glucose} \text{ moles}\\ &= \var{precround(((5 * a) / glucose), 2)} \text{ moles to 2 d.p.} \end{align}$
in $\var{5 * a}$ grams of glucose.
b)
Sodium chloride has a molecular weight of $\var{NaCl}$. How many moles of sodium chloride are there in $\var{5 * b}$ grams?
Solution:
Putting our numbers into the formula we find that there are
$\begin{align}\dfrac{\var{5 * b}}{\var{NaCl}} &= \var{(5 * b) / NaCl} \text{ moles} \\ & = \var{precround(((5 * b) / NaCl), 2)} \text{ moles to 2 d.p.} \end{align}$.
in $\var{5 * b}$ grams of sodium chloride.