In this question, the amount of water absorbed by an egg completely depends on the amount of sugar in which it placed. The amount of sugar stands alone and cannot be altered by other variables hence it is classified as an independent variable.
While the amount of water they absorbed can not stands alone and would be altered by variable like the amount of sugar. Hence, it is classified as the dependent variable.
Therefore, in this example, the different amount of sugar is categorized under the independent variable while the amount of water gets absorbed is categorized under the dependent variable.