Define RAM and ROM
RAM
A random-access memory (RAM) stores binary data in the arrays. The data can be addressed from anywhere in matrix. Data is changed easily and stored back in RAM, in whole or in any part. A RAM is called as read/write memory some times.An instance of RAM is a word processing computer file which you are actively working on.
There are 2 kinds of RAM: dynamic RAM (DRAM) and static RAM (SRAM).
A DRAM uses IC transistors and capacitors, and the data is stored as charges on the capacitors. The charge should be replenished frequently, or it will be lost by means of discharge. Replenishing is done automatically hundred times per second.
An SRAM uses a circuit known as flip-flop to store the data. This gets rid of the requirement for constant replenishing of charge, but tradeoff is that SRAM ICs needs more elements to store the given amount of data.
With any RAM, data is erased when appliance is switched off, unless some provision is made for the memory backup. The common means of memory backup is use of a cell or battery. Modern IC memories require little current to store their data with a backup battery lasts as long in circuit as it would on the shelf. A memory which disappears when the power is removed is called as volatile memory. If the memory is retained when the power is removed, it is nonvolatile.
ROM
By the contrast to RAM, read-only memory (ROM) can be accessed, in the whole or in any part, but not written over. A standard ROM is programmed at the factory. This permanent programming is called as firmware. But there are ROMs which you can program and reprogram yourself