una pregunta y un idioma= una lengua. -a is the marker for feminine in spanish, so most of the time sustantives ending in -a are femenine. exceptions are few. also some nouns allow for both genres: el mar/la mar.
-o is usually a marker for masculine but be careful: you'll find in spoken "la moto" that is short for "la motocicleta". Also words ending in consonant tend to be masculine. el tren, el ordenador, el avión. -e is ambiguous: el coche, la noche. problem is that gramatical genre has no logic: you can't look at a thing and ascertain if it is masculine or feminine, just must learn.