This depends on how you repair your computer. If you don't have a Windows XP CD, then you should have a restore CD provided by your manufacturer. If this CD reformats your drive before copying all the files back to your computer, then this can delete viruses. If it simply replaces files without reformatting the drive, then some viruses can hide.
The best way to avoid viruses is to use a good virus checker and practising some common sense.