Computer viruses are named after biological viruses because they can replicate like viruses and spread from computer to computer. Viruses infect files and programs by embedding their code. They are then unknowingly spread through file sharing and email attachments. To prevent virus infections, users should keep their operating systems and software updated, use antivirus software, avoid unknown files from the internet or email, and be wary of virus hoaxes.