Can a school tell you , you can’t write your matric exams at school if you stay in the school …

Can a school tell you , you can’t write your matric exams at school if you stay in the school hostel and there is no rule in the schools code of conduct ? 

[Source] Click here to view the answer to this question