Time to go find out. I got the KJV from Project Gutenberg and looked up all the why's and wherefore's.
First off, sometimes the question "Why?" is purely rhetorical (e.g. Judges 21:3, where they know perfectly well why a tribe is now going to be missing, or Exodus 32:11 where Moses is arguing with God).
Second, lots of times the question is a plea for help rather than for an explanation (Psalm 10:1, 22:1, 42:9, 44:23, 74:1,11, 80:12, 88:14, 89:47; Why have you forsaken/forgotten/hidden from us?, or Isaiah 63:17 Why did you make us err from your ways?, Jeremiah 14:8,19, Lam 5:20)
Third, sometimes He does answer and it turns out to be "because of your sins" (Joshua 7:7, Isaiah 58:3, Jer 5:19, Jer 13:20, 16:10, 22:8, 22:28, Malachi 2:14). When there is an explanation given, this is it--but sometimes this is explicitly not the explanation (see the rebuke to Job's friends, or John 9:3.
Jesus' disciples often ask "Why?", but they don't really know who they are talking to yet, so I don't think I'll count those.
I found just a handful of other cases:
Numbers 11:11 Moses asks God why he is afflicting Moses with all this responsibility. God says to appoint elders to help him. I take it Moses was asking for help, and got it, so this is like the second case above, but with an answer.
Judges 6:13 Gideon asks God why is all this befallen us if God is with us? God says go, I'm sending you.
Jeremiah 15:18 Why is my pain perpetual? God answers: I will make you strong
Jeremiah 12:1 Why does the way of the wicked prosper? God answers--are you giving up so soon?
Exodus 5:22 Moses asks God why he was sent, because things look worse than before. God answers "Now you will see"
Habakkuk 1:3,13 Why do you show me evil? Why do you allow evil? God answers: wait for the judgment, it will come
Job: Job asks lots of why's: God does not address any of them but shows what he is like and asks if Job can deal with even that
Ezekiel 18:19 Rhetorical Why? Doesn't the son bear the iniquity of the father? God answers "No, he doesn't."
Matthew 27:46,Mark 15:34 Jesus asks "Why have you forsaken me?" He gets no immediate answer
So sometimes the answer is "Wait and see" and sometimes "Be strong." And sometimes it is "Repent." And there's God's answer to Job "Can you do what I do?" with the implicit "If not, how can you understand the why?"
I skipped the Apocrypha. Sorry about that. If my memory doesn't deceive me, they wouldn't change the results much.