2346 Then (v 34), Jesus is seen questioning his examiner: first, we have Christ's question; then Pilate's answer, Am I a Jew?
2347 The Evangelist says, Jesus answered, asking a question in return, Do you say this of your own accord or did others say it to you about me? There are two reasons why someone asks a question. Sometimes it is to find out something that the questioner does not know; as when a student questions his teacher. Sometimes one asks a question about things he already knows in order to learn what answer will be given; as when a teacher questions his student. Now our Lord knew ...both what he asked about, and what answer would be given, and thus he was not asking out of ignorance, "All are open and laid bare to the eyes of him with whom we have to do" (Heb 4:13). Rather, he asked so that we might know what the Jews and Gentiles thought, and at the same time be taught about that kingdom.
Source: Commentary on John