Maybe it is a strange question but as a curiosity, if there are pirated softwares installed on our school's computer, is it considered as fair use to take exam using them?
It’s not fair use, but it is most likely not your responsibility. If the copyright holder found out, they might take the school to court, but not you.
We tend to think of schools, especially below university level, as places run by boards of education, principals, teachers, etc., and the students merely attend. But if anyone ever accused the student of violating copyright by taking the exam, a plausible defense was the student was acting as an agent of the school, and therefore it was the school which violated the copyright through the authorized actions of its agent, the student.