Don’t you know the answer to those questions?
you are being tested by Allah, is the answer.
yes, those in all kinds of pain (poverty, starvation, drought, wars, rapes, slavery, child abuse etc.) are your test subjects so that you get some lessons and don’t do what they did. Be a good kid and you will get lots of sweets and all the play stuff. Be a bad one and you will be locked in a dark room with bad bad monsters.
Assuming that all the “judgment day” and other “hereafter” events do happen, I don’t know how you people are gonna deal with the God but I sure have a lot more questions for God to answer me than the other way around.