Is wearing a cap permissible for boys, or girls?
All Perfect Praise is due to Allah, The Lord of The Worlds.
In principle, anything is permissible sol long as there is no Sharia evidence prohibiting it, thus wearing the cap by boys is permissible as long as it isn`t done in imitation of the disbelievers. Moreover, a Muslim woman should avoid all that which attracts the attention of men because whatever leads to the forbidden is forbidden. And Allah Knows Best.
Is it permissible for one to masturbate in order not to commit fornication?
This is called committing the milder of the two evils such as eating a carcass in fear of death, and this happens when committing fornication is very likely to occur.
Is it permissible for a woman whose menses exceeded (15) days to pray, fast and do what was prohibited on her to do during the latter period?
If the menses exceeded 15 days then it is deemed menstruation, and in this case she is obliged to pray and fast and to do what was impermissible for her to do during the latter period. In addition, she is obliged to make an ablution for each obligatory prayer after it's due time and making sure that impuity is removed. Finally, your menstruation period is over (Questioner) simlar to your menstruation in the previos month.
How are those killed in wars punished with the torment of the grave if they are not buried?
The torment of the grave refers to the suffering that the deceased experiences between the day of their death and the Day of Resurrection, which is called the Barzakh period. Similarly, it includes the blessings of the grave, whether the deceased is buried or not. And Allah The Almighty Knows Best