Du`a for something the outcome of which has already been determined
Question

What is the ruling on offering du`a (supplication) for something that has already been decided and its outcome has already been determined? What I mean is if the school gets in touch with a student and says to him: Come and get your results, is it permissible for him to offer supplication on the way, such as saying: O Lord, let the results be a high mark, and the like, even though the result has already been printed and is ready to be handed over to the student?
Praise be to Allah.The matter of supplication (du`a) is a matter of worship that is broad in scope, and it is one of the best, greatest and most beloved to Allah, may He be exalted, to the extent that the Prophet (blessings and peace of Allah be upon him) described du`a (supplication) as ‘ibaadah (worship). It was narrated by Ahmad (18849) and at-Tirmidhi (3232) that an-Nu‘maan ibn Basheer (may Allah be pleased with him) said: The Messenger of Allah (blessings and peace of Allah be upon him) said: “Indeed, du`a (supplication) is what ‘ibaadah (worship) is.” Then he recited the verse (interpretation of the meaning): “And your Lord says, ‘Call upon Me; I will respond to you.’ Indeed, those who disdain My worship will enter Hell [rendered] contemptible” [Ghaafir 40:60]. At-Tirmidhi said: It is hasan saheeh. It was also classed as saheeh by al-Albani in Saheeh wa Da‘eef Sunan at-Tirmidhi (2969). See also: Tafseer at-Tabari (3/485).
With regard to supplication in the case mentioned here, there are two scenarios:
The first scenario:
The du`a has to do with a matter that has been determined and the person knows the outcome, such as if he knows that he has failed [an exam], so he prays to Allah to let him pass, or he knows that So-and-so has died, so he prays to Allah to bring him back to life. In this case, the du`a is pointless, and in fact is regarded as overstepping the mark in du`a, because it is a prayer for something that is impossible.
It was narrated from ‘Abdullah ibn Mughaffal (may Allah be pleased with him) that he said: I heard the Messenger of Allah (blessings and peace of Allah be upon him) say: “There will be among this ummah people who overstep the mark in purification and supplication.” Narrated by Ahmad (17254) and Abu Dawood (96). Classed as saheeh by al-Albani in Saheeh Sunan Abi Dawood –al-Umm (86).
Shaykh al-Islam Ibn Taymiyah said: Overstepping the mark in supplication may sometimes take the form of asking for something for which it is not permissible to ask, such as help to do or obtain something that is haraam; and sometimes it may take the form of asking for something that Allah will not do, such as asking Him to let him live until the Day of Resurrection, or asking Him to relieve him of things that are inevitable for human beings, such as the need to eat and drink, or asking Him to show him something of His unseen, or to make him among those who are infallible and protected from sin, or to give him a child without having a wife, and other things, the asking of which are a kind of transgression that Allah does not like, and He does not like the one who asks for them.
End quote from Majmoo‘ al- Fataawa (15/22).
Ibn ‘Aabideen said: It is haraam to ask for things that are ordinarily impossible, when he is not a prophet or wali (close friend of Allah), such as asking to be free of the need to breathe air, so that he can be safe from suffocation, or asking to be free from sickness throughout his lifetime, so that he can benefit from his strength and faculties always, when the normal state of affairs indicates that this is impossible… All of that is haraam.
End quote from Radd al-Muhtaar (4/121).
The second scenario:
When he knows that something has happened, as mentioned in the question, but he does not know what was decreed and came to pass. In this case, there is nothing wrong with offering supplication, and it is prescribed for him to turn to Allah, may He be exalted, praying for whatever he wants, for he does not know the decree of Allah that has already come to pass, whether it is good or bad. It was narrated by Ahmad (22694) – and classed as hasan by al-Albani in Saheeh at-Targheeb wa’t-Tarheeb (1634) – from Mu‘aadh (may Allah be pleased with him), that the Prophet (blessings and peace of Allah be upon him) said: “Du’aa’ is of benefit with regard to that which has come down and that which has not come down [of calamities], so, O slaves of Allah, I enjoin you to persist in offering du`a.”
The general meaning of the Prophet’s words, “Du’aa’ is of benefit with regard to that which has come down and that which has not come down [of calamities]”, indicates that it is prescribed to offer supplication in the manner described.
Al-Mubarakfoori said in Tuhfat al-Ahwadhi (5/427), regarding the Prophet’s words, “Nothing can put back the divine decree except supplication”: … He enjoined us to seek medical treatment and offer supplication, even though what has been decreed will surely come to pass, because it [the divine decree] is hidden from people and they do not know what will happen and what will not happen. This is supported by the report narrated by at-Tirmidhi from Ibn ‘Umar: “Du’aa’ is of benefit with regard to that which has come down and that which has not come down [of calamities].” End quote.
So long as a person does not know what has been decreed, it is prescribed for him to offer supplication for the good things that he seeks, and to be spared the bad things that he fears and seeks to protect himself from. In that case, his du`a is included in the general meaning of the texts which encourage and urge us to offer supplication, such as the words of the Prophet (blessings and peace of Allah be upon him):  “There is no Muslim who offers a supplication in which there is no sin or severing of ties of kinship, but Allah will give him one of three things in return for it: either He will hasten for him what he asked for, or He will store it [the reward for it] up for him in the Hereafter, or He will avert from him an equivalent evil.” They said: Then we should do a lot of that [offering supplication]. He said “Then Allah will reward you more.” Narrated by Ahmad in al-Musnad (11133) from Abu Hurayrah (may Allah be pleased with him); classed as saheeh by al-Albani in Saheeh at-Targheeb wa’t-Tarheeb (1633).
And Allah knows best.