Bad idea, kitty cat.
Why is there a 'ב' before the word 'נחש'? This seems like it's saying 'The cat touches in a snake'.
The word "לגעת" is always followed by the preposition "ב"-something, it's just something that you have to remember.
ha-chatulá nogá'at be-nachásh.
HOW CAN I KNOW THE SUBJECT'S GENDER?
With this example it's easy:
l חתול - male cat
l חתולה - female cat
With other animals, if there isn't a male-female pair like this, or with any other noun, you simply have to learn the gender of the words by heart.