You're not understanding the question right. The question is not asking you to figure out the pKa. The main point of this question is for you to distinguish between when a solution is protonated or deprotonated. When the pH is 9, it is most likely deprotonated since it's basic. All of the choices are giving you the protonated color except d, which is the deprotonated color of sample D.
This question might seem very complicated at first, but it's actually pretty simple if you know what it's asking.