Computer components fall into two broad groups: hardware, the physical parts you can touch, and software, the programs and instructions that run on that hardware.
A joystick, keyboard, and mouse are all physical input devices. You can hold them, plug them in, and they wear out over time like any physical object, which makes them hardware. An operating system, however, is a set of coded instructions (a program) that manages the computer's hardware and lets other programs run. It has no physical form of its own; it exists as data stored on a disk and loaded into memory, which is exactly what defines software.
A common mistake is to think that anything installed on a computer, including drivers or apps, counts as hardware simply because it "belongs" to the machine. The correct distinguishing test is whether the item is a physical object (hardware) or a set of instructions/code (software).
Exam tip: when identifying software among a list, look for the item without physical form: it is written, installed, and run, rather than plugged in or touched.