A Buddha dominates the Dhamma and that domain allows him to answer any question that is posed to him and this is because he sees the Dhamma as it is, and he only has to see to describe it. Experts, on the other hand, need to resort to memory and can not answer anything that is not there without risk of being wrong.
Knowing is different from remembering. Like the lookout on top that describes what he sees to those below. Different question is that they can understand the descriptions of the vigilante. They can only recognize what they have known.
It is its kamma.
Collection of Medium Length Discourses
MN 58. Abhayarājakumāra Sutta
Speech to Prince Abhaya
“Reverend sir, if those who are learned nobles and learned brahmins and learned housewives and learned inmates approach the Tathagata and ask him a question they have built, the Lord has already reflected in his mind about it, thinking: he asks me this way , then, asked like this, will I respond like this or does (the answer) occur to a Tathagata immediately? “
“Well, then, Prince, I’ll ask you a question in return. How can I please you, so you can answer it. What do you think about this, prince? Are you an expert in the different parts of a car? “
“Yes, reverend sir, I am an expert in the different parts of a car. “
“What do you think of this, prince? If those who have approached you should ask: ‘What is the name of this particular part of the car?’ Had they already thought about this in their minds, thinking: ‘If those who have approached me ask me this way, then I will answer them’ or will it occur to me (the answer) immediately? “
“Because, reverend sir, I am a famous car driver, expert in the different parts of a car, all the particular parts of a car are completely known to me, so (the answer) would occur to me immediately.”
“Even so, Prince, if those who are learned nobles and learned Brahmins and learned housewives and learned inmates approach the Tathāgata and ask him a question they have built, (the answer) occurs to the Tathagata immediately. What is the reason for this? It is, Prince, that the constitution of the Dhamma is completely penetrated by the Tathagata, and due to its full penetration of the constitution of the Dhamma (the answer) it occurs to the Tathagata immediately. “