Your reaction, $\ce{C6H12O6 -> CO2}$ is a redox half-reaction. The n-factor of a molecule/compound in a redox reaction is defined as the change in the oxidation state per molecule (as defined in Del Pate's answer). The easy to visualize definition is the amount of electrons (in $\pu{mol}$) donate or accepted per $\pu{1 mol}$ of the compound in the given redox half-reaction.
Can someone explain how to correctly calculate n-factor with few more examples?
Let's look at following redox half-reactions and find the n-factor by these two different definitions:
$$\text{Example 1:} \qquad \qquad \ce{MnO4- ->[acid] Mn^2+ }$$
The oxidation number of $\ce{Mn}$ of the reactant is $+7$ while that of the product is $+2$. The change in the oxidation state per $\ce{MnO4-}$ is $+5$. Thus, the n-factor of $\ce{MnO4-}$ is $5$ in acid medium.
If we balance this redox half-reaction, we get:
$$\ce{MnO4- + 8 H+ + 5 e- -> Mn^2+ + 4 H2O}$$
Thus, the amount of electrons accepted per $\pu{1 mol}$ of $\ce{MnO4-}$ in the given redox half-reaction is $5$. Hence, the n-factor of $\ce{MnO4-}$ is $5$ in acid medium.
$$\ce{MnO4- ->[base/neutral] Mn^4+ \ (\text{as} MnO2)}$$
The oxidation number of $\ce{Mn}$ of the reactant is $+7$ while that of the product is $+4$. The change in the oxidation state per $\ce{MnO4-}$ is $+3$. Thus, the n-factor of $\ce{MnO4-}$ is $3$ in base/neutral medium.
$$\ce{MnO4- + 2 H2O + 3 e- -> MnO2 + 4 OH-}$$
Thus, the amount of electrons accepted per $\pu{1 mol}$ of $\ce{MnO4-}$ in the given redox half-reaction is $3$. Hence, the n-factor of $\ce{MnO4-}$ is $3$ in base/neutral medium.
$$\text{Example 2:} \qquad \qquad \ce{CuS -> Cu^2+ + SO2 }$$
The oxidation number of $\ce{S}$ of the reactant is $-2$ while that of the product is $+4$. The change in the oxidation state per $\ce{CuS}$ is $+6$. Thus, the n-factor of $\ce{CuS}$ is $5$ in this redox reaction.
If we balance this redox half-reaction, we get:
$$\ce{CuS + 2 H2O -> Cu^2+ + SO2 + 4 H+ + 6 e- }$$
Thus, the amount of electrons accepted per $\pu{1 mol}$ of $\ce{CuS}$ in the given redox half-reaction is $6$. Hence, the n-factor of $\ce{CuS}$ is $6$ in this redox half-reaction.
Now, let's look at the given reaction in the question:
$$\ce{C6H12O6 -> CO2}$$
Suppose we don't know the oxidation number of $\ce{C}$ of glucose $(\ce{C6H12O6})$ since there are $\ce{6C}$s in the molecule. Thus, we can approach to solve the problem by the second method. If we balance this redox half-reaction, we get:
$$\ce{C6H12O6 + 6 H2O -> 6CO2 + 24 H+ + 24 e- }$$
Thus, the amount of electrons accepted per $\pu{1 mol}$ of $\ce{C6H12O6}$ in the given redox half-reaction is $24$. Hence, the n-factor of $\ce{C6H12O6}$ is $24$ in this redox half-reaction. This demonstration reveals that even without knowing the change in oxidation number during the reaction, you can find the n-factor.
Note: This finding shows that the given answer for the question is incorrect.