In the four years of Spanish in high school and one semester in college, I was never taught that cats or dogs could be either masculine or feminine (of course, I am talking about the words). Is this true for all animals?
when it's possible, yes. That is, some of the animal words don't end in -o or -a and we just use the one word for male or female. For those, you can, of course, use an adjective to distinguish (for example macho or hembra)