Removing things from the oven halfway through is not very friendly to baked goods. In general, they'll collapse as they cool off since the structure isn't cooked and set, and the leavening (baking soda/powder in these cases) will be spent, so there's no way to get what you originally wanted. It might be something like what'd happen if you forgot the leavening in the first place.
The exception is if they'd only just started - not bubbling much yet, just warm. In that case, you could probably get away with yanking them out quickly, and waiting to bake later.
Cookies could probably survive this by leaving them in, though. They don't have very long baking times - somewhere in the 5-15 minute range. Your oven won't cool off all that much in that time without power. So if you leave them in for a little bit longer than the original baking time, they'll probably be fine. If your oven has a window, look in with a flashlight to check on them - you don't want to open it to check them.
A cake is iffier. If it's 15 minutes into a 45 minute baking time, you may just be out of luck. I think I'd still leave it in, hoping that the power comes back within 5-10 minutes, in which case it'd probably make it. As I mentioned earlier, if you lose power early and for long enough, the cake will have spent its leavening and collapsed. You could finish baking it, but it'll still be collapsed - it probably won't have a terribly palatable texture (definitely dense, maybe chewy).
The only time this has actually happened to me was with some cornbread muffins, around 2/3 of the way through their baking time, and the oven didn't have a window. I wildly guessed how much extra time to add, pulled them out then, and they were great. So there is hope!