In short, a computer virus is a small script of code that runs as a program with a purpose of altering the way a computer operates. Of course this is all done without the permission or knowledge of the user.
1. The program must be able to execute on its own. In this way it will often replace the execution of another program with its own code and run itself instead of the intended program.
2. It must be able proceed to replicate itself. For example, it may replace other executable files with a copy of the virus infected file. Viruses can infect desktop computers and network servers alike.
How do viruses spread?
With its ability to replicate itself, a virus spreads from one computer to another and throughout an entire computer network. Everywhere it spreads to, it copies the same process as the one that preceded it and thus is able to infect a vast amount of computers in a very short space of time.
Like a human virus, and also like Trojan Horses, a computer virus can range in the damage it causes. Some may cause only mildly annoying effects while others can damage your hardware, software or files.
Like Trojans, almost all viruses are attached to an executable file. This means that it could be present on a computer but may not actually infect it unless a malicious program is run or opened.
Also similar to human viruses, a computer virus cannot be spread without human action, such as running an infected program, to keep it going. As a result, viruses are often spread by individuals who unknowingly send on infected files to others as attachments in emails.
How to prevent computer virus infections?
It is always recommended to use an anti-virus solution. Furthermore, that software solution must always be kept up to date in order to ensure any vulnerabilities are kept patched and able to block out any known threats.