A computer virus, worm, and trojan horse are all types of malware, but they spread and operate differently. A virus attaches to legitimate files and requires user interaction to spread, while a worm is self-replicating and spreads independently through networks.…