The difference between which and what
TLDR: It’s complicated. Maybe take the time to read the following!
Both which and what fall into the category of the ‘interrogative determiner’. Determiners describe information about a subject, such as its number (one, the, two, some, those) or its familiarity (my, her, their, his, someone’s). These determiners are not to be confused with adjectives, which describe attributes (shape, colour, speed, smell, feel etc).
So how are you supposed to know which (or what) is the correct one to use? These two words quite often form the basis of a question and do, therefore, cause some confusion. Figuring out which of the two to use sometimes comes down to specificity.
Which is generally used when the number of possibilities is small in number or the choices for your answer have already been laid out for you.
Which team are we playing this weekend? (Out of a list of X number of possible teams you would ever play, say, in your district or division.)
Which books did you want me to take back to the library? (You would have taken out a certain number of books; therefore, the ones you would want taken back would be from that small group of books only.)
Which city was your favourite on your holiday? (Out of the fixed number of places you visited, you would pick one—unless they were all good, of course!)
Which teacher did you have in Year 2—Mr Rogers or Ms Cole? (With a selection of only two, you would definitely use which.)
In contrast, what is used in a broader sense, where the number of options could be infinite.
What sort of job does he have? (There could be hundreds in a single workplace.)
What time should I expect you tomorrow? (There are 1,440 possible times each day, a large number of choices. Yes, I did just figure that out.)
What information do you have for me? (Information being something you can’t count, a mass noun, you would use what.)
What breed of dog is that? (With everything from pedigrees to crazy hybrids, the choices are quite vast.)
Still confused? Try this. If asked what your favourite colour is, you have an almost infinite number of colours to choose from. However, if given a choice between only four colours, you would be asked which of those colours you like best, as your options have been narrowed considerably.
With the basics out of the way, what and which are also used in indirect questions:
Do you know which platform our train leaves from?
Does your mum have any idea what kind of car you’re going to buy?
I was wondering which school you went to—Cheltenham, Hornsby or Epping?
I’d like to know what sport you play on the weekends.
However, just when you thought you’d got it, there is an exception. When the speaker believes there is a wide variety of options (when, in reality, that might not be the case), they would use what instead of which. For example:
Which school in Sydney did you go to?
What school in Sydney did you go to?
In this example, imagine the asker of the question is not a local Sydney-sider and doesn’t realise how many schools there are in the city. Both questions are grammatically fine, though you should ideally use the latter, as there are many schools in Sydney.
Contrast the above example with:
Which dress are you going to wear to the wedding?
What dress are you going to wear to the wedding?
This depends on context. In the first instance, the question could be posed to someone who only has a few dresses, so her answer would be limited to a small number of options, hence which. However, if the person had an extensive wardrobe with, say, dozens of different dresses to choose from, the latter what is perfectly acceptable.
And for one final example of determining these two words in a question:
Which language does she speak?
What language does she speak?
Again, context is key. If the subject was a child who had, say, a Romanian mother and an English father, the answer to the question would either be Romanian or English (or both). However, the second question could apply to someone whose nationality is unspecified or a hybrid of many. So while each question, by themselves, is grammatically correct, one or the other would not work in a certain situation.
And there we have it! Long-winded but hopefully worthwhile.