The outputs of a software developed from scratch by a student during his/her studies are used in writing his/her thesis. Can the student's supervisor or the University claim to be a copyright holder of the software? What if the student was paid by the University as a Research Assistant?
The general rule is that the author of the software owns the copyright, so that would be the student. This is regardless of whether the student writes the code for fun, or for a thesis. If a student is hired to write that code, then it kind of depends on the university rules, and who hires the student. In the case of a "work for hire", the employer owns the copyright. However, it is non-trivial to determine whether that principle is applicable in the case of a student hired by the university. In part, it depends on which country this is in because work for hire laws are not exactly the same everywhere, and in part it depends on the details of the employment my a university. In a typical US institution RA appointment, it would come down to university policy – some universities declare that copyright in all student-written software is retained by the student. You would need to look for something resembling an "IP Policy" – here is a sample, note that such policies are subject to revision.