Can you use brandy instead of rum in a cake recipe
Almost certainly yes, but the flavors will be slightly different.
Brandy is likely to be slightly more acidic than rum, but otherwise quite similar in composition, and should perform in the same way.
If you want a more tailored answer, you should provide more information, such as the full recipe.
Almost certainly, "No". Changing rum to brandy makes "Brandy Cake" (a quick search reveals several "Brandy Cake" recipes). In other words, it becomes something different entirely (can I replace Tuna for Beef in a steak?)
There is nothing wrong with Brandy Cake, but it isn't 'Rum Cake'.
If a dish is defined by a certain ingredient (such as the rum in rum balls), then substituting for the signature ingredient really isn't practical. You would be creating a new dish, or changing what its core is.