Actually, there is no problem in distinguishing between male and female for animate objects (humanbeings &animals).
Ex:
علي : a man's name (male).
فاطمة : a woman's name (female).
أسد : the male lion (male).
لبؤة : the female lion (female).
Remarks:
1-Some men's names end with "ة" (the feminene mark), but they are still treated as male, because they are men's names as well.
Ex: حمزة ، حيدرة / أسامة / عكاشة
2-And some women's names doesen't end with the feminine mark "ة", but they are treated as female names.
Ex: سعاد، أمل، إيمان، صفاء
But for inanimate objects, i'm afraid that there is no rule, and you'll have to memorize. But if the word ends with ة ( like in طاولة =table ), then it is considered female.
Ex:
شمس : the sun (female).
قمر : the moon (male).
كرسي : chair (male).
طاولة : table (female).
Remark:
Plants are mostly treated as female.
Ex:
نخلة : palm tree.
شجرة : tree.
وردة/زهرة : flower