Q: A computer or laptop keeps track of time even when it is switched off. Why?

A desktop PC has a lithium cell or battery (the same is used in digital diaries) called a BIOS cell inside the CPU, and attached to the motherboard, which keeps track of time even after the computer is powered down, whereas in laptops, the battery of the laptop itself is used to keep track of time. This battery also saves the settings required during a boot operation.