G’day
You ought to be aware that the assumption that all calories consumed and not burned are stored as fat at a rate of 3500 calories per pound has no experimental support. And it seems unlikely in face of the fact that high-energy compounds (such as ketones and bile salts) are secreted in the breath, sweat, urine, and faeces (from bile). Several diets, which are apparently successful, do not work by limiting calories (eg. the Atkins diet). Note well that type I diabetics lose weight no matter how much they eat, unless insulin is supplied. Note also that biochemical researchers were able to produce a strain of genetically-engineered mice with defective insulin-receptors on their fat cells: these mice ate 20% more than controls, but achieved only half the weight.
In response to the OP:
A piece of cake is about 1/4 each of sugar, flour, butter, and eggs, so it consists about 50% of carbohydrate. This carbohydrate will be broken down to monosaccharides in the gut, absorbed into the blood, and converted to glucose. When this glucose reaches the pancreas it will suppress the secretion of glucagon by the alpha cells and stimulate the production of insulin by the beta cells.
Among other effects (some of which bear on long-term storage of fat) glucagon stimulates the production of urine, and insulin suppresses it. So the effects of eating a slice of cake include retention of fluid, and a short-term increase in weight at the scales.
For example, last Sunday night I was forced by politeness to eat a serving of about 750 mL of thick soup or thin stew with quite a lot of barley, carrots, parsnips, turnip, and pasta in it. The following morning, I had gained 2 kg in weight (about 4.5 pounds). By Tuesday morning the weight gained had disappeared again.
As regards the longer term, insulin stimulates fat cells to lay down fat, glucagon stimulates them to release it into the bloodstream. These two hormones also determine whether metabolically active cells run on fat or on glucose (except for nerve cells and red blood cells, which are obligate sugar-burners). They also control the production of cholesterol (by the liver), vasodilation, vasoconstriction, eicosanoid synthesis, blood pressure, and a handful of other things.
It is well worth looking up ‘insulin’ and ‘glucagon’ in Encyclopaedia Britannica.
Regards,
Agback