What is the difference between what and which?
For example, what is the difference between the following sentences?
What is correct?
Which is correct?
Which and what have different meanings. Which is used in questions to ask somebody to be exact about one or more people or things from a limited number.
For example, you ask What name do you prefer for your son? because there are many possible names to give to a baby.
Suppose that you're instead talking to somebody who tells you that his wife prefers Michael, her mother prefers Andrew, and his mother likes Alberto. If you ask him Which name do you prefer? you are asking him the name he prefers from among those three; if you ask him What name do you prefer? you are asking him the name he prefers, including any other name that isn't Michael, Andrew, or Alberto.
In your case, Which is correct? could be asked to a person who is talking about two or more options, for example You could do this or that. Your question is essentially asking Between this and that, what is correct?
What is used when you are asking a question that can have an unlimited number of possible answers.
What is your name? You can receive any answer!
Which is used when the options for the answer are limited.
Which one is the most beautiful? The red or the yellow? You can receive only two answers.
The difference is the number of possible options to choose from. So, if the number of possibilities is the whole universe, you ask "WHAT". If it is limited, you ask "WHICH".
Let me explain:
Q. What color shirt will you wear?
Here, the asker could accept any color as the answer. So, if you say, 'taupe', they might ask, "What is that?", but they won't say, "Wrong answer".
Q. Which color shirt will you wear?
Here the asker has laid down a limited number of colors to choose from. So, he could say:
...between red and gray...
Therefore, the answer "Blue" could be technically wrong. Again technically, the reply should be, "I don't like either. I'll wear blue."
Please note that what I said above is just an example to distinguish WHAT from WHICH. Therefore, simply answering "Blue" means, "I don't like either. I'll wear blue." That's why I used the word "technically".
So, to conclude,
'What' stands as the subject and 'which' is the object of the sentence, also 'which' can stands as subject of the which clause that replace the whole clause of the previous sentence. 'What' is used to ask an unknown thing while 'which' means a choice among several things.