Egyptian universities will be closed from 22 until 31 May due to the presidential election, the Supreme Council of Universities has announced.
The election will be take place on 26-27 May.
The head of Al-Azhar University has condemned the killing of three soldiers near the campus in the early hours of Tuesday morning.
The attack would not affect the exam schedule, Osama El-Abd added.
University students are currently sitting their end-of-year exams. There have been fears of a repeat of the violence that disrupted the mid-year exams.
The interior ministry said the attackers opened fire from a car, killing three soldiers, and injuring a police officer and eight soldiers, during a protest by around 250 pro-Mohamed Morsi students outside the university dormitories.
Attacks on police and army personnel have become frequent across Egypt since the ouster of Morsi last July. At least 500 police and soldiers have been killed.
Security forces have intervened on a regular basis to disperse anti-government demonstrations at Al-Azhar and other universities, leaving a number of students dead and hundreds arrested.