Wa `alaykum As-Salamu wa Rahmatullahi wa Barakatuh.
In the Name of Allah, Most Gracious, Most Merciful.
All praise and thanks are due to Allah, and peace and blessings be upon His Messenger.
In this fatwa:
Answering your question, the Fatwa Center at islamweb, states:
Doing good deeds increases piety and faith, and fasting is included within good deeds. Allah says about the righteous: “… And whosoever fears Allah and keeps his duty to Him, He will make a way for him to get out (from every difficulty). And He will provide him from (sources) he never could imagine. …” (At-Talaq 65:2-3)
He also says: “… and whosoever fears Allah and keeps his duty to Him, He will make his matter easy for him.” (At-Talaq 65:4)
Allah says: “But whosoever turns away from My Reminder (i.e. neither believes in this Qur’an nor acts on its orders, etc.) verily, for him is a life of hardship …” (Taha 20:124)
In the same vein, the Prophet (peace be upon him) said: “A human being is deprived of livelihood due to committing a sin.” (Ahmad)
On the basis of what is mentioned above, we state that there is no objection to observe fasting with the intention you specified in your question (i.e. have an easy exam).
Then, we advise the questioner to avoid misdeeds and sins at the same time, since committing sins opens the door of evil.
Allah Almighty knows best.
Editor’s note: This fatwa is from Ask the Scholar’s archive and was originally published at an earlier date.