It's better to say " make a cake " or " bake a cake ".
Though you can find a lot of web pages using "cook a cake".
Examples:
He knows how to bake a cake better than anyone else.
Making a basic sponge cake is very easy.
english.stackexchange.com/users/3782/Manoochehr
Baking is done in an oven, cooking is done on a stove-top and typically implies using water.
You can bake pies, roasts, cookies, bread, casseroles, pizza, and cakes.
You can cook vegetables and noodles.
It is common and acceptable to say "cook a meal" or "cook dinner" rather than "bake a meal" or "bake dinner", even if the meal was all prepared in an oven.
It becomes more confusing when you consider certain other food types.
Eggs can be fried, scrambled, or boiled, but you rarely hear of anyone baking or cooking eggs.
The bottom line is that bakers bake things and those things they produce are " baked ", whereas cooks (or chefs) cook things and those things they produce are " cooked ."
english.stackexchange.com/users/3800/oosterwal
It's not wrong, but it's more common to see 'bake a cake', as that is almost always the cooking method used.
english.stackexchange.com/users/None/
Provided that it is an oven based cake you should say " bake ".
If describing a cake that isn't made in the oven (eg a fish cake)
you could say " cook ".
english.stackexchange.com/users/4739/Tom Ravenscroft
It should be "bake a cake" and not "cook a cake".
Baking is when you put something in an oven-toaster-griller, and cooking is when you put something on the stove-top.
english.stackexchange.com/users/4924/Logophile
I just checked dictionary.com.
It says that "cook" means: to prepare (food) by the use of heat, as by boiling, baking, or roasting. to subject (anything) to the application of heat.
So cooking includes boiling, baking and roasting.
Wich means its not even on the same level of precision.
So we can say we "cook" for everything that's been heated but we can't cook a salad or cold food.
I guess that something prepared on the stove-up can only be "cooked" but then something baked is also "cooked".
The same would be applied to roasted and boiled.
If you guys have other sources that say the opposite please share ;)
english.stackexchange.com/users/9930/Daniel
Is it wrong to say "to cook a cake"?
Is it wrong to say "cook a cake"?
english.stackexchange.com
<grammaticality>
english.stackexchange.com/questions/10900
english.stackexchange.com/users/3997/Ehsan
If the cake in question is an oven-based cake, you should say "bake". Ultimately, baking is done in an oven and cooking is done on a stove-top. The correct answer should be "bake a cake". Baking is done in an oven, cooking is done on a stove-top and typically implies using water. The bottom line is that bakers  bake  things produce " baked " goods, whereas cooks (or chefs)  cook  things and produce are "cooked" food . Cooking can includs boiling, baking and roasting, and although something prepared on the stove-up can only be "cooked,  something baked can also be "cooked". We can say we "cook" for everything that's been heated but we can't cook a salad or cold food. It will all depend on how the cake is made, but if the cake is an oven-based cake, then it is "bake a cake". 
If the cake in question is an oven-based cake, you should say "bake". Ultimately, baking is done in an oven and cooking is done on a stove-top. The correct answer should be "bake a cake". Baking or making a cake would be the preferred terms. While cooking can be used as a general term ('cook a meal'), cakes are almost exclusively baked and so this is the term used.
It's not wrong to say cook a cake, but it's more common to say bake or make a cake. To bake, implies baking in the oven, to cook would implies to cook on the hob.   Whilst "cook a cake" is not technically wrong, "back a cake" would be better. Cooking is generally performed on a stove whilst baking is generally performed in an oven.
Baking is done in an oven, cooking is done on a stove-top and typically implies using water.   Difference between bakers and cooks. The bottom line is that bakers  bake  things and those things they produce are " baked ", whereas cooks (or chefs)  cook  things and those things they produce are " cooked ." Baking is something that goes into the oven It should be "bake a cake" and not "cook a cake". Difference between baking and cooking.
Baking or making a cake would be the preferred terms. While cooking can be used as a general term ('cook a meal'), cakes are almost exclusively baked and so this is the term used.
Whilst "cook a cake " is technically not wrong, "bake a cake" would be better. Baking is generally done in an oven whilst cooking is generally done on a stove.