God did not ask questions because He did not know the answers. He was not trying to figure out whether Adam was hiding in one or another of the trees. Later in the account of Cain and Abel when Cain was displeased that his offering was rejected, God asked him a series of questions.
So in both those incidences God asked a lot of questions.
In II Samuel 12:9, God asked David through Nathan, Why did you despise the word of the Lord? by doing what is evil in His eyes. In Isaiah 6:8, God asked Isaiah, Whom shall I send, and who will go for Us? And in Matthew 16:15, the Lord asked, Who do you say I am? The apostle John recorded many of Christ's questions as well. God asks questions to get us to face the situation. He asks us, we have to answer, and whatever we answer better be the truth. And then even if we answer the truth, often we have condemned ourselves, but that is one of the main reasons God asks questions - to get us to face the situation ourselves to more deeply realize what we have done.
This is what Jesus asks us when we have been trying to go it on our own, Have you been successful? Are you satisfied? Questions like that. He asks these questions through His inspired written Word so that we might recognize our hunger, need, failure, and need to turn to Him.
First of all, please notice in verse 12 God removed the gift that God alone had given Cain to be a farmer. Then we see he became both fugitive and vagabond. Both words indicate aimless wandering.
In the Hebrew fugitive is the word nûa‛ 5128 in Strong's and is a verb meaning to shake, to stagger, to wander. It refers to a displaced person, a wanderer, a vagrant. Vagabond is from the Hebrew word nûd 5110 in Strong's and is also a verb, but more emphatically has the sense of aimless motion or actions. It refers to a person moving about aimlessly without a home.
Brethren, all of mankind is on a journey, but the curse of sin to those not under the blood of Jesus Christ with eyes on Him and the goal of the Kingdom of God, is aimlessness in motion and in action on their journey.
It is simply the Bible's way of expressing, of nature symbolically crying out, appealing for vengeance. When I say nature here I do not necessarily mean the ground itself, or the trees, or whatever, man is included in nature. In what man does other creatures is included within that. In this case the other creatures are fellow human beings. He is showing nature, as it were, crying out, appealing to God for vengeance to right the wrong that was being done in it, or you might say, done against it.
Did you ever think in your wildest imagination that God is unaware of what is going on and that He will not take retribution? My King James Version Study Bible says in the margin of this verse, Thus God's judgment is on those who by whatever means [D & X, D & E, a simple abortion] abort human life. The cry in verse 10 is for vengeance, and in Proverbs 26:2, it says, The curse causeless shall not come.
If God cursed Cain, what kind of a curse do you think is on this nation?
The blood speaks. You might recall Genesis 4:10, where God told Cain that Abel's blood cried out from the ground for vengeance upon the murder of an innocent man. God said that because God would have been justified in taking vengeance, but this verse says that the blood of Jesus speaks out for something better, something better than for vengeance because God would be completely justified in taking our lives because of our murder of His innocent Son.