In the US and in secular universities that receive US Government funding, the example you give above could be a problem for the Professor. It would be best for the Professor to say that discussion of religion is not part of this class. As for talking with a student about personal private beliefs outside of class, that is fraught with a multitude of potential problems.
First sentence is correct, second sentence may not be. It really depends on the agreement that the professor has with the university and how that university is entangled with government funding. It is a shifting line in what constitutes individual free speech and what constitutes speech as a Government official.
For example, a police chief going to Catholic mass on Sunday in his uniform coming off working the night shift. This would fall under individual free speech. However, a police chief going to an rousing Evangelical Church Rally with him speaking to the crowd in his police uniform. This would not be allowed under Establishment clause - as it gives the impressions that Government is endorsing Evangelical Christianity over other religions and non-believers.