Memory and Storage: RAM, ROM, Cache, Storage Units and MCQs

Memory is where a computer keeps the data and instructions it is working with, and storage is where it keeps them for the long term. Computer operator and IT tests ask many short questions here: which memory is volatile, which ROM can be erased with ultraviolet light, what cache does, and how many bytes make a kilobyte. Learn the memory hierarchy and the unit ladder and most questions become direct recall or a one-line calculation.

Asked in: PPSC, FPSC, NTS, ETEA, KPPSC, SSC, IBPS and ICS/ECAT computer

Primary and secondary memory

Primary memory (main memory) is directly accessed by the CPU. It includes RAM and ROM, along with cache and registers at the faster end. It is fast but limited in size, and RAM loses its contents when power is switched off.

Secondary memory (auxiliary or backup storage) holds data permanently, even without power. Hard disks, solid-state drives, USB flash drives, memory cards and optical discs are examples. The CPU cannot work directly on secondary storage: programs and data are first loaded into RAM.

Memory that loses its contents when power is lost is volatile (RAM, cache, registers). Memory that keeps its contents is non-volatile (ROM, flash, hard disk, optical discs).

RAM and its types

RAM (Random Access Memory) is the working memory of the computer. Any location can be reached directly in the same time, which is what random access means. It is read-write memory and is volatile. The more RAM a computer has, the more programs and data it can hold at once without slowing down.

There are two main kinds. Static RAM (SRAM) stores each bit in a flip-flop circuit; it does not need refreshing, is very fast, but is costly and takes more space per bit, so it is used for cache memory. Dynamic RAM (DRAM) stores each bit as a charge on a tiny capacitor that leaks, so it must be refreshed thousands of times a second; it is cheaper and denser, so it is used for main memory.

The RAM modules sold for modern PCs are a type of DRAM called SDRAM, in DDR generations such as DDR4 and DDR5.

ROM and its types

ROM (Read Only Memory) is non-volatile memory whose contents are written during manufacture or by special means and are normally only read during use. It stores firmware, such as the startup program that tests the hardware and loads the operating system.

Masked ROM is written at the factory and cannot be changed. PROM (Programmable ROM) is supplied blank and can be programmed only once by the user. EPROM (Erasable PROM) can be erased by exposing the chip to ultraviolet light and then reprogrammed. EEPROM (Electrically Erasable PROM) can be erased and rewritten electrically while in the circuit.

Flash memory is a fast form of EEPROM that erases in blocks. It is used in USB drives, memory cards, SSDs and the firmware chip of modern motherboards.

Registers, cache and the memory hierarchy

Registers are the smallest and fastest memory, located inside the CPU. They hold the instruction being executed, the data being processed and memory addresses. Examples include the program counter (address of the next instruction), the instruction register (current instruction) and the accumulator (results of the ALU).

Cache memory is a small, very fast SRAM memory between the CPU and main memory. It keeps copies of frequently used data and instructions so the CPU does not have to wait for slower RAM. When the needed data is found in cache it is a cache hit; otherwise it is a cache miss. Cache is organised in levels: L1 is the smallest and fastest, followed by L2 and L3.

Arranged from fastest to slowest, memory runs registers β†’ cache β†’ main memory (RAM) β†’ secondary storage. Moving down the hierarchy, speed and cost per bit fall while capacity rises.

Secondary storage devices

A hard disk drive (HDD) stores data magnetically on spinning platters read by a moving head. The surface is divided into circular tracks, and each track into sectors. HDDs give large capacity at low cost but have moving parts.

A solid-state drive (SSD) stores data in flash memory with no moving parts, so it is faster, quieter and more resistant to shock than an HDD, though it usually costs more per gigabyte. USB flash drives and SD memory cards also use flash memory.

Optical discs are read by a laser. A CD holds about 700 MB, a single-layer DVD about 4.7 GB and a single-layer Blu-ray disc about 25 GB; Blu-ray uses a blue-violet laser of shorter wavelength than the red laser of a DVD. ROM discs (CD-ROM) can only be read, R discs can be written once, and RW discs can be rewritten. Magnetic tape stores data sequentially and is still used for cheap, large backups.

Units of memory: bit to terabyte

The smallest unit of data is the bit (binary digit), 0 or 1. Four bits make a nibble and eight bits make a byte, which is enough to store one character in ASCII.

In computer exams and in the way operating systems such as Windows report memory, each larger unit is 1024 (2¹⁰) times the one before it: 1 KB = 1024 bytes, 1 MB = 1024 KB, 1 GB = 1024 MB, 1 TB = 1024 GB, followed by PB, EB, ZB and YB. Use 1024 unless a question clearly says otherwise.

Storage makers and the SI standard use the decimal convention, where 1 KB = 1000 bytes and 1 GB = 1000 MB. The international standard names for the binary units are kibibyte (KiB), mebibyte (MiB), gibibyte (GiB) and tebibyte (TiB). This difference is why a new 1 TB drive appears smaller in Windows.

Solved examples

  1. Which memory is volatile? (A) ROM (B) EEPROM (C) RAM (D) Flash memory
    1. Volatile memory loses its contents when power is switched off.
    2. ROM (A), EEPROM (B) and flash memory (D) all keep their data without power, so they are non-volatile.
    3. RAM loses its data when the computer is turned off.
    Answer: (C) RAM
  2. How many megabytes are there in 4 GB (binary convention)?
    1. 1 GB = 1024 MB.
    2. 4 GB = 4 Γ— 1024 MB = 4096 MB.
    Answer: 4096 MB
  3. Express 2 MB in bytes using the 1024 convention.
    1. 1 MB = 1024 KB and 1 KB = 1024 bytes, so 1 MB = 1024 Γ— 1024 = 1,048,576 bytes.
    2. 2 MB = 2 Γ— 1,048,576 = 2,097,152 bytes.
    Answer: 2,097,152 bytes
  4. Arrange from fastest to slowest: RAM, hard disk, register, cache.
    1. Registers are inside the CPU and are the fastest of all.
    2. Cache (SRAM) sits between the CPU and RAM and is faster than RAM.
    3. RAM is faster than any secondary storage, and the hard disk with its moving parts is the slowest of the four.
    Answer: Register β†’ Cache β†’ RAM β†’ Hard disk
  5. A ROM chip can be erased by placing it under ultraviolet light and then programmed again. What type is it? (A) PROM (B) EPROM (C) EEPROM (D) Masked ROM
    1. Erasing with ultraviolet light is the defining feature of EPROM.
    2. PROM (A) can be programmed only once and cannot be erased; masked ROM (D) is fixed at the factory.
    3. EEPROM (C) is erased electrically, not with ultraviolet light.
    Answer: (B) EPROM
  6. A pen drive has 2 GB of free space. How many video files of 512 MB each can be copied to it? (Use 1 GB = 1024 MB.)
    1. Free space = 2 Γ— 1024 = 2048 MB.
    2. Number of files = 2048 Γ· 512 = 4.
    3. Exactly 4 files fit; a fifth file would need another 512 MB.
    Answer: 4 files

Exam shortcuts

Common mistakes

Practice MCQs

  1. How many bits make one byte?
    A) 4
    B) 16
    C) 8
    D) 1024
    Answer: C) 8 β€” A byte is 8 bits. Four bits make a nibble, 16 bits make two bytes, and 1024 is the number of bytes in a kilobyte, not the number of bits in a byte.
  2. Which of these memories is non-volatile?
    A) DRAM
    B) ROM
    C) SRAM
    D) Cache
    Answer: B) ROM β€” ROM keeps its contents when the power is switched off, so it is non-volatile. DRAM and SRAM are both kinds of RAM and lose their data without power, and cache is made of SRAM, so it is volatile as well.
  3. Which is the fastest memory in a computer?
    A) CPU registers
    B) Cache memory
    C) Main memory (RAM)
    D) Solid-state drive
    Answer: A) CPU registers β€” Registers are inside the CPU itself and are the fastest memory. Cache is the next fastest, main memory is slower than cache, and an SSD, though fast for storage, is secondary memory and much slower than all three.
  4. 1 KB is equal to how many bytes (binary convention used in computer exams)?
    A) 1000
    B) 512
    C) 1024
    D) 2048
    Answer: C) 1024 β€” In the binary convention 1 KB = 2¹⁰ = 1024 bytes. 1000 bytes is the decimal (SI) kilobyte used by storage makers, 512 bytes is half a kilobyte, and 2048 bytes is 2 KB.
  5. Which type of RAM must be refreshed thousands of times per second?
    A) SRAM
    B) DRAM
    C) PROM
    D) EPROM
    Answer: B) DRAM β€” DRAM stores each bit as charge on a capacitor that leaks, so it must be refreshed constantly. SRAM uses flip-flops that hold their state without refresh, and PROM and EPROM are non-volatile ROM types that never need refreshing.
  6. Cache memory is usually made of:
    A) DRAM
    B) SRAM
    C) EPROM
    D) Magnetic disk
    Answer: B) SRAM β€” Cache is built from SRAM because it is very fast and needs no refresh. DRAM is slower and is used for main memory, EPROM is read-only memory for firmware, and a magnetic disk is secondary storage far too slow for caching inside the processor.
  7. Which of the following stores data magnetically on spinning platters?
    A) Solid-state drive
    B) DVD
    C) USB flash drive
    D) Hard disk drive
    Answer: D) Hard disk drive β€” A hard disk drive records data magnetically on rotating platters. A solid-state drive and a USB flash drive use flash memory with no moving parts, and a DVD is an optical disc read by a laser.
  8. How many megabytes are in 3 GB? (Use 1 GB = 1024 MB.)
    A) 3072 MB
    B) 3000 MB
    C) 3024 MB
    D) 30720 MB
    Answer: A) 3072 MB β€” 3 Γ— 1024 = 3072 MB. 3000 MB uses the decimal convention, 3024 MB wrongly adds 3 GB to 1024, and 30720 MB is ten times the correct value.
  9. Which ROM can be erased by exposing the chip to ultraviolet light?
    A) PROM
    B) EEPROM
    C) EPROM
    D) Masked ROM
    Answer: C) EPROM β€” EPROM chips have a small window through which ultraviolet light erases the data. PROM can be written only once, EEPROM is erased electrically rather than by ultraviolet light, and masked ROM is fixed at manufacture and cannot be erased.
  10. Approximately how much data does a standard single-layer DVD hold?
    A) 700 MB
    B) 25 GB
    C) 1.44 MB
    D) 4.7 GB
    Answer: D) 4.7 GB β€” A single-layer DVD holds about 4.7 GB. About 700 MB is the capacity of a CD, about 25 GB is a single-layer Blu-ray disc, and 1.44 MB was the capacity of an old 3.5-inch floppy disk.
  11. Which register holds the memory address of the next instruction to be executed?
    A) Accumulator
    B) Instruction register
    C) Program counter
    D) Memory data register
    Answer: C) Program counter β€” The program counter holds the address of the next instruction. The accumulator holds results of ALU operations, the instruction register holds the instruction currently being executed, and the memory data register holds data being moved to or from memory.
  12. How many bits are there in 16 bytes?
    A) 128
    B) 64
    C) 2
    D) 256
    Answer: A) 128 β€” 16 bytes Γ— 8 bits = 128 bits. 64 bits is only 8 bytes, 2 comes from dividing by 8 instead of multiplying, and 256 bits would be 32 bytes.
  13. Which statement about SSDs compared with hard disk drives is correct?
    A) SSDs store data magnetically on platters
    B) SSDs lose all data when power is off
    C) SSDs are a type of optical storage
    D) SSDs have no moving parts and are faster
    Answer: D) SSDs have no moving parts and are faster β€” An SSD stores data in flash memory with no moving parts, so it is faster and more resistant to shock. Storing data magnetically on platters describes a hard disk; flash memory is non-volatile, so an SSD keeps data without power; and optical storage means discs read by a laser, such as DVDs.
  14. Arrange in increasing order of size: GB, KB, TB, MB.
    A) KB, MB, GB, TB
    B) MB, KB, GB, TB
    C) KB, GB, MB, TB
    D) TB, GB, MB, KB
    Answer: A) KB, MB, GB, TB β€” The ladder from small to large is kilobyte, megabyte, gigabyte, terabyte, each 1024 times the one before. Placing MB before KB or GB before MB breaks this order, and listing TB first gives the decreasing order, not the increasing one.
  15. A memory card is advertised as 64 GB using the decimal convention (1 GB = 1000 MB). Why does Windows show less than 64 GB?
    A) Part of the card is reserved for RAM
    B) Windows counts 1 GB as 1024 Γ— 1024 Γ— 1024 bytes
    C) Flash memory loses data over time
    D) The card is formatted as ROM
    Answer: B) Windows counts 1 GB as 1024 Γ— 1024 Γ— 1024 bytes β€” The maker counts 64 Γ— 10⁹ bytes, but Windows divides by 1024 Γ— 1024 Γ— 1024 for each GB, so the same bytes show as about 59.6 GB. No part of a memory card becomes RAM, flash memory does not shrink with time, and a memory card is not formatted as ROM.

Questions

What is the difference between RAM and ROM?

RAM is volatile read-write memory used as the working memory for running programs. ROM is non-volatile memory, normally only read, that stores firmware such as the startup program.

Is 1 KB equal to 1000 or 1024 bytes?

Computer exams and Windows use 1 KB = 1024 bytes. Storage makers and the SI standard use 1000 bytes; the standard name for 1024 bytes is kibibyte (KiB).

Why is cache memory needed?

The CPU is much faster than RAM. Cache keeps copies of frequently used data and instructions close to the CPU so the processor waits less, which speeds up the whole computer.

Which memory questions are most common in job tests?

Volatile versus non-volatile memory, RAM and ROM types, the fastest memory, cache, the order of units from bit to terabyte and simple unit conversions appear most often.