They can attach to various locations of the original file, replace code, fill in open spaces in the code, or create companion files to work with an executable file. File viruses fall into different classes depending on which method they use to infect. File viruses usually infect EXE programs, though some can infect other kinds that can be executed. Most of the file viruses are memory resident and wait in the memory until the user runs another program. While another program is running, the virus replicates.
Parasitic viruses are a type of file virus.
As the name might suggest, parasitic viruses attach to or insert into a file, but the file remains usable. Viruses can attach to the top or end of a file or can insert themselves into the middle of the file code. In the Jerusalem virus, the virus attached to the top of a file while other information was attached to the end of the file to enable the virus to tell the infected files from those not infected. When a virus is added to the end of the file, the virus also changes the top so that the virus code is launched first. Companion viruses are file viruses that can infect a program without changing its file code.