Different parts of a PC house memory to store a type of information. The hard drive is the essential storage device used to save all the necessary data like OS files, applications, music, videos, and so on. Other than the hard drive, we have the RAM (Random Access Memory), ROM (Read-only Memory), and so on.
What is a RAM (Random Access Memory)? 
After the magnetic hard drive or SSD, RAM is the biggest piece of memory that exists on the PC hardware. RAM is used to store the programs and data being used by the CPU in real-time. The data on the random access memory can be read, written, and deleted any number of times.
It is a volatile memory which means the data put in the RAM vanishes the minute you cut the power supply. That is one reason we can't use random access memory as permanent storage regardless of the fact that it's way quicker than the conventional magnetic disk-based hard drives. 
The majority of the modern operating systems we use have built-in workarounds to deal with RAM's volatile nature. All the work done is continually saved on the hard drive to avoid situations where unexpected system shutdown would result in data loss.
Different Types of RAM:
SRAM (Static RAM): It stores a bit of data using the state of a six transistor memory cell. SRAM is way faster than DRAM but costlier.
DRAM (Dynamic RAM): It stores a bit of data using a pair of transistors and capacitors which constitute a DRAM memory cell.
What is ROM (Read-Only Memory)? 
Another prominent memory type present on the PC is the ROM. As the name proposes, the data on the memory can only be read by the PC. Anyway, what's the reason these read-only memory chips are being used when we have the RAM chips? 
The ROM is a non-volatile memory; it remembers the data regardless of whether the power supply is removed. ROM is used to store firmware for the hardware which barely gets any update, for example, the BIOS. 
The data on the traditional type of ROM is hardwired to it, i.e., written at the time of manufacturing. After some time, the read-only memory has been developed to support deleting and rewriting of data, although, it can't achieve the efficiency level of a random access memory chip.
Types of ROM:
Mask ROM: This is the type of ROM for which the data is written during the manufacturing of the memory chip.
PROM (Programmable Read-only Memory): The data is written after the memory chip has been created. It is non-volatile.
EPROM (Erasable Programmable Read-only Memory): The data on this non-volatile memory chip can be erased by exposing it to high-intensity UV light.
EEPROM (Electrically Erasable Programmable Read-only Memory): The data on this non-volatile memory chip can be electrically deleted using field electron emission (Fowler–Nordheim tunneling). Modern EEPROMs are quite efficient in terms of their read-write capabilities.
The types mentioned above were the semiconductor-based ROMs. Optical Storage media like CD-ROM is likewise a type of read-only memory.
RAM vs ROM: What Is The Difference Between RAM and ROM?
RAM: The data is not permanent and it can be altered any number of times.
ROM: The data is permanent. It can be altered but only a limited number of times that too at slow speed.
RAM: It is a high-speed memory.
ROM: It is much slower than the RAM.
CPU Interaction
RAM: The CPU can access the data stored on it.
ROM: The CPU can not access the data stored on it. In order to do so, the data is first copied to the RAM.
Size and Capacity
RAM: Large size with higher capacity.
ROM: Small size with less capacity.
RAM: Primary memory (DRAM DIMM modules), CPU Cache (SRAM).
ROM: Firmware like BIOS or UEFI. RFID tags, microcontrollers, medical devices, and at places where a small and permanent memory solution is required.
RAM: It doesn’t come cheap.
ROM: Way cheaper than RAM.
Both RAM and ROM have their set of advantages and disadvantages. The ROM is cheap and can hold information for all time however it has its limits. Then again, RAM is very useful than the read-only memory however it can make a burning hole in your pocket.