Malware is short for MALicious softWARE. NCERT defines it as any software made to damage hardware, steal data or cause other trouble to the user. Viruses, worms, ransomware, Trojans and spyware are the kinds of malware it names first, and the chapter adds adware and keyloggers.

Exam questions on the types of computer virus usually test two things: how each type spreads, and what it does once it is inside. The table below sets them side by side.

TypeHow it spreadsWhat it doesExamples in NCERT
VirusInserts its code into programs; activated when a user opens the infected fileSteals passwords or data, corrupts files, spams contacts, can take control of the machineCryptoLocker, ILOVEYOU, MyDoom, Sasser and Netsky, Slammer, Stuxnet
WormStandalone; copies itself and moves through the network with no user actionDamaging or unexpected behaviour on infected systemsStorm Worm, Sobig, MSBlast, Code Red, Nimda, Morris Worm
TrojanLooks like legitimate software; the user installs it (attachment or download)Acts like a virus or worm; some open backdoors. Does not self-replicateNamed after the wooden horse of Troy
RansomwareTargets user dataBlocks or encrypts data, or threatens to publish it, and demands a ransomWannaCry (May 2017)
SpywareRuns without the user's knowledgeGathers data such as browsing, card or login details and sends it out—
AdwarePop-ups, web pages, installation screensShows ads to earn money for its developer; may carry unsafe links—
KeyloggerSoftware, or a thin hardware overlay on the keyboardRecords every key pressed, including passwords—

The term computer virus was coined by Fred Cohen in 1985. Like its biological namesake, a virus needs a host: it inserts its code into executable files and stays dormant until a user opens the infected file.

A worm needs no host and no user. It is a standalone program that replicates itself and travels through the network. That is the single most tested difference.

A Trojan is different again. It does not replicate at all. It relies on looking harmless, so the user installs it, for example by opening an email attachment. Like the Greek soldiers hidden in the wooden horse, the harm is inside something that looks like a gift.

Ransomware either blocks access to the user's data, often by encrypting it, or threatens to publish it, and demands payment. NCERT's example is WannaCry, which in May 2017 infected almost 200,000 computers across 150 countries and demanded ransom in Bitcoin.

Spyware collects information about a person or an organisation without their knowledge and sends it to someone else. Adware shows advertisements to earn money for its developer; it is usually more annoying than harmful, but its ads can link to other malware.

A keylogger records keystrokes. It can be software, or hardware placed over the real keyboard. Typing passwords on an online virtual keyboard, whose key layout changes every time, defeats a software keylogger. An ordinary on-screen keyboard has a fixed layout and is easier to read.

NCERT lists four common routes: files downloaded from the Internet, spam email links and attachments, infected removable storage such as pen drives, and network propagation, which is how worms move.

Antivirus software, also called anti-malware, uses five detection methods:

  1. Signature-based detection: compares files with a database called the Virus Definition File (VDF). An outdated VDF misses new malware.
  2. Sandbox detection: runs a new file in a virtual environment and watches its behaviour.
  3. Data mining: uses data mining and machine learning to classify a file as benign or malicious.
  4. Heuristics: compares suspect code with known virus code.
  5. Real-time protection: watches programs while they run in memory.

For network-level defences such as firewalls, and for attacks such as DoS and phishing, see cyber security terms. For how networks carry these threats, see networking devices.

Q1. Which malware can spread across a network on its own, without a host program or a user opening a file? easy

✅ Answer: (c) Worm

💡 Explanation: A worm is a standalone program that replicates on its own and spreads through the network. A virus needs a host file and a user to run it.

Q2. Which malware disguises itself as legitimate software and does NOT replicate itself? easy

✅ Answer: (a) Trojan

💡 Explanation: A Trojan tricks the user into installing it because it looks legitimate. NCERT notes it does not self-replicate or infect other files.

Q3. WannaCry, which hit computers in about 150 countries in May 2017, is an example of which type of malware? easy

✅ Answer: (d) Ransomware

💡 Explanation: WannaCry encrypted victims' data and demanded payment in Bitcoin, which is how ransomware works.

Q4. In signature-based detection, the database of virus signatures an antivirus uses is called the: medium

✅ Answer: (b) Virus Definition File (VDF)

💡 Explanation: NCERT calls the signature database the Virus Definition File. An outdated VDF misses new malware, so the antivirus must be updated regularly.

Q5. Who coined the term 'computer virus', according to NCERT? medium

✅ Answer: (a) Fred Cohen

💡 Explanation: NCERT says Fred Cohen coined the term computer virus in 1985. The Morris Worm, named after its author, is a different piece of malware.

Is every piece of malware a virus?

No. Virus is one type of malware. Worms, Trojans, ransomware, spyware, adware and keyloggers are other types. People often say 'virus' for all of them, but exam questions treat them as separate.

What is the main difference between a virus and a worm?

A virus attaches its code to a host program and needs a user to open the infected file. A worm is a standalone program that copies itself and spreads through the network without any user action.

Why is an online virtual keyboard safer than an on-screen keyboard?

An on-screen keyboard has a fixed QWERTY layout that a keylogger can work out. An online virtual keyboard shuffles the keys every time, so recording click positions does not reveal what was typed.

How this page was prepared. Drafted with AI assistance (Claude (Anthropic AI model)) from the sources listed above. Automated checks also covered structure, internal links and duplicate text. Software checks cannot confirm facts.

Found an error? Report it and we will correct the page.