I am not sure whether to say "Quem emit Iulius?" or "Quid emit Iulius?" if I want to know what Julius is buying. I know the interrogative pronoun should be in the accusative case but it is not clear to me what gender it should be. As far as I understand it should be the gender of the word that represents what Julius is buying, but if I knew what that was I would not need to ask the question. Is it grammatically correct to use either?
If the thing being bought is just some thing, then the correct gender is neuter. It is used for things of unspecific gender, whereas masculine would be used for people of unspecific gender.
If you use quem, you are asking whom Julius is buying. Unless he is shopping for slaves, go with quid to ask what he is buying. If it could be slaves or something else, then it is a general thing and you should go with neuter.