I am thinking of buying an iMac as a replacement for my laptop. Do iMac have batteries like in a laptop or do we have to always keep it plugged-in to power while using?
iMac is a consumer desktop computer and doesn't come with a built in battery. Neither is it possible to install batteries in an iMac.
Unlike a laptop (MacBook) an iMac is not portable and have to be kept plugged in to a power source while in use.
Whether an iMac can be used as a replacement for a laptop depends on your specific workflow. It runs the same operating as a Apple laptop (MacBook) and comes with mostly comparable hardware and feature set.