Mark 5:9 ESV:
9 And Jesus asked him, “What is your name?” He replied, “My name is Legion, for we are many.” 10 And he begged him earnestly not to send them out of the country. 11 Now a great herd of pigs was feeding there on the hillside, 12 and they begged him, saying, “Send us to the pigs; let us enter them.” 13 So he gave them permission. And the unclean spirits came out, and entered the pigs, and the herd, numbering about two thousand, rushed down the steep bank into the sea and were drowned in the sea.
And was he asking because he didn't know?