Is it permissible for a student to study on Shabbat for an exam that will be administered during the coming week, or would this violate the prohibition of "Hachana," preparing on Shabbat for a weekday?
The Shulchan Aruch (307:17) cites two views as to whether one may study on Shabbat subjects other than Torah. One opinion allows learning only subjects of Torah, whereas the second view cited in the Shulchan Aruch, that of the Rashba (Rabbi Shlomo Ben Aderet, Spain, 1235-1310), allows learning mathematics, science, medicine and the like. It is generally assumed that whenever the Shulchan Aruch cites two opinions, he sides with the first view cited; in this instance, then, he follows the position that forbids studying on Shabbat any subject outside the realm of Torah study. (Within Torah, however, all fields are allowed to be studied on Shabbat, which the exception of Megilat Eicha and other distressing sections of Tanach, which are inconsonant with the festive aura of Shabbat.)
Thus, it would clearly be forbidden to prepare on Shabbat for exams in one's general studies. The question remains, however, whether one is permitted to study for exams in Torah-related fields, such as Chumash, Halacha or Talmud.
Rabbi Moshe Halevi Z"L, in his work Menuhat Ahava, in Helek 1, page 252, rules that this is permissible. The prohibition of "Hachana" stems from the concern for preserving the honor and sanctity of Shabbat. Making preparations on Shabbat for the coming week undermines the special stature of Shabbat and thus infringes upon its honor. Studying Torah, however, even if done with explicit intention of preparing for an upcoming exam, is not considered a mundane activity that infringes upon the honor of Shabbat, and is therefore permissible. One may even state explicitly that he studies for the purpose of preparing for his exam.
Thus, while it is forbidden to study on Shabbat general subjects, one may study on Shabbat any area of Torah, even with the explicit intention of preparing for an upcoming exam.