Adjectives agree with nouns, so you need to know that the noun in question is masculine or feminine.
In this case, "huile" is feminine : une huile pure.
sorry this is a bit unrelated but "l'enfant" can be both masculine or feminine, yes? "l'enfant est pur(e)" would be ambiguous then?
Yes, you are right. Only context would help you to know whether l'enfant is a boy or a girl.
The contraction l' can be either le or la, all that you know is that the next letter is a vowel or a 'soft h'.
Duo will show you the gender of the French noun when you mouse-over the word in the sentence above. Other than that, there is always the dictionary: http://www.larousse.com/en/dictionaries/french-english/huile/40484
French has some funny ideas about noun gender compared to other Romance languages. I was also surprised that huile is feminine when it’s masculine in Italian, Spanish and Portuguese.
The Latin noun (oleum) was neuter so, at some point, someone had to pick one of the remaining genders, but we probably can't trace them back.
Other Latin neuter nouns became masculine, like "un oeuf" (ovum).
Not all contractions are recognized by the system, so to be on the safe side, maybe you should avoid them.