Memory (also called main memory or primary memory) is the part of a computer that holds the instructions and data the CPU is working with. The CPU reads from it and, for some types, writes to it, using an address for each location. In this lesson we look at the memory types (RAM, ROM, EPROM and EEPROM) and the features used to compare them (speed, size, word size and volatility).
If you did CSEC, Inside the Computer: Input, Processing, Memory, Storage and Output (IPOS) is a short refresher on RAM and ROM. Here we go further.
Where the bits are kept
Every memory chip is a grid of tiny cells, and each cell stores one bit (a 0 or a 1). You have already met a circuit that can do this: the flip-flop. A flip-flop has two stable states, so once it is set or reset it keeps that bit for as long as it has power. See Flip Flops, The SR Flip-Flop – Practical Introduction and The SR Latch.
- Static RAM (SRAM) stores each bit in a flip-flop. It is fast and does not need refreshing, but each cell needs several transistors, so it costs more and holds less. Cache memory is made of SRAM.
- Dynamic RAM (DRAM) stores each bit as a charge on a tiny capacitor. The charge leaks away, so the cells must be refreshed thousands of times a second. DRAM is cheaper and holds more, so it is used for the main RAM in PCs and phones.
- The registers inside the CPU are also groups of flip-flops, one per bit. An 8-bit register is 8 flip-flops side by side.
Either way, when the power goes, the flip-flops and capacitors lose their state. That is why RAM is volatile.
Memory types
RAM (Random Access Memory)
RAM is read/write memory. It holds the operating system, the programs that are open and the data they are using. Random access means any location can be reached directly by its address, in the same time, wherever it is. RAM is fast, but it is volatile: its contents are lost when the power is switched off.
ROM (Read Only Memory)
ROM is written once, when the chip is made, and after that it can only be read. It is non-volatile, so its contents are still there when the power comes back on. ROM is used for programs that must never change, such as the control program in a washing machine or microwave, and, in older computers, the start-up (boot) program.
EPROM (Erasable Programmable ROM)
An EPROM can be programmed, erased and programmed again. To erase it, the chip is taken out of the circuit and ultraviolet (UV) light is shone through a small quartz window on top of it, usually for several minutes. This erases the whole chip. A device called a programmer then writes the new contents. EPROM is non-volatile.

Image: EPROM AM27C256DC by Anonimski, CC BY-SA 3.0, via Wikimedia Commons.
EEPROM (Electrically Erasable Programmable ROM)
An EEPROM is erased and rewritten electrically, so it can be changed while it stays in the circuit, one byte at a time. Writing is much slower than writing to RAM, and each cell can only be rewritten a limited number of times, so it is used for data that changes now and then, like settings. EEPROM is non-volatile.
Flash memory is a type of EEPROM that erases in blocks instead of single bytes, which makes it faster to rewrite. It is used for the BIOS/UEFI firmware on motherboards, USB flash drives, memory cards, SSDs and phone storage.
| Type | Read/write? | Volatile? | How it is erased or changed |
| RAM | Read and write | Yes | Overwritten by the CPU at any time |
| ROM | Read only | No | Cannot be changed (written when made) |
| EPROM | Read only in normal use | No | UV light erases the whole chip; then reprogrammed |
| EEPROM | Read; rewritten now and then | No | Electrically, in the circuit, a byte at a time (flash: in blocks) |
Try it 1Which memory type?
Read the scenario and tap the memory type it describes. Wrong answers give you a hint, so you can try again.
Try it 2Compare the memory types
Tap one or more features. The table keeps only the memory types that have all the features you chose.
| Type | Volatile? | How can it be changed? | Typical use |
|---|---|---|---|
| RAM | Yes | Read and written freely by the CPU, very fast | Operating system, open programs and their data |
| ROM | No | Cannot be changed. Written when the chip is made | Fixed programs in appliances, start-up code |
| EPROM | No | Take it out, erase the whole chip with UV light, reprogram it in a programmer | Older firmware, prototypes |
| EEPROM | No | Erased and rewritten electrically in the circuit, a byte at a time (slow) | Settings and small amounts of data that change now and then |
| Flash (a type of EEPROM) | No | Erased electrically in blocks, so faster than byte-by-byte EEPROM | BIOS/UEFI firmware, USB drives, SSDs, phone storage |
Memory features
Volatility
Volatile memory needs power to keep its contents; non-volatile memory keeps them with the power off. RAM is volatile. ROM, EPROM, EEPROM and flash are non-volatile. This is why you must save your work to storage, and why the first instructions a computer runs at power on have to come from ROM or flash: RAM is empty at that moment.
Try it 3Pull the plug
Store a few values, then switch the power off and on again. Watch which memory keeps its contents.
Power: ON
What happened (newest first):
The ROM values are just an example of a fixed start-up program.
Speed
Speed is how quickly data can be read from or written to memory, often given as the access time. Electronic memory has no moving parts, so its access time is measured in nanoseconds. A hard disk has to move its read/write head and wait for the disk to spin, so its access time is measured in milliseconds. In general, the closer the memory is to the CPU, the faster and smaller (and more expensive per byte) it is: registers, then cache, then RAM, then secondary storage.
Try it 4Fastest to slowest
Tap the items in order, from the fastest to access to the slowest. Then press Check.
Your order:
Size (capacity)
Size is how much the memory can hold, measured in bytes (KB, MB, GB). Each location has its own address. With n address lines there are 2n different addresses, so:
capacity = number of locations × word size
For example, 10 address lines give 210 = 1,024 locations. If each location holds an 8-bit word, the capacity is 1,024 bytes, which is 1 KB.
Word size
The word size is how many bits the CPU works on in a single operation. It is usually the size of the CPU’s registers and the amount of data moved to or from memory in one go. Most computers and phones today are 64-bit; small microcontrollers may be 8-bit or 16-bit. A larger word size lets the CPU work on bigger numbers in one step and move more data per memory access.
Try it 5Capacity calculator
Choose the number of address lines and the word size. The calculator shows how many locations there are and the total capacity (1 KB = 1024 bytes).
Your turn: a memory has 16 address lines and a word size of 8 bits. What is its capacity?
Variables live in RAM: a C example
When your C program runs, it is loaded into RAM, and every variable you declare is given some bytes of RAM at an address. The program below declares an int, then prints its value, how many bytes it uses (sizeof) and its address (%p). The & in &x means "the address of x". (Recap: Variables, Format Specifiers and printf (%d), and for addresses, C Pointers.)
#include <stdio.h>
int main()
{
int x = 5;
printf("Value: %d\n", x);
printf("Bytes: %d\n", (int) sizeof(x));
printf("Address: %p\n", (void *) &x);
return 0;
}
Run it in Code::Blocks. The first line will show Value: 5. The number of bytes depends on your compiler (on most desktop compilers an int is 4 bytes, which is 32 bits). The address is printed in hexadecimal and will be different on your computer, and it may change each time you run the program, because the operating system decides where in RAM the program goes. When the program ends, or the power goes, that RAM is given back and the value of x is gone: volatility in action.
You can also watch variables change while a program runs in the debugger: see Adding 2 numbers, declaring integer variables, watching variables.
Practice questions
1. Give two differences between ROM and RAM.
Show answer
ROM is read only and non-volatile: its contents are fixed and are kept when the power is off. RAM can be read from and written to, and it is volatile: its contents are lost when the power is switched off.
2. EPROM and EEPROM are both non-volatile. Explain how each one is erased, and why this makes EEPROM easier to update inside a finished device.
Show answer
An EPROM is taken out of the circuit and the whole chip is erased with ultraviolet light, then reprogrammed in a programmer. An EEPROM is erased electrically and can be rewritten while it stays in the circuit, so a device can update it (for example a firmware update) without being opened.
3. Explain what is meant by the term volatile, and give one example of volatile and one of non-volatile memory.
Show answer
Volatile memory loses its contents when the power is removed. RAM is volatile; ROM (or EPROM, EEPROM, flash) is non-volatile.
4. A phone is advertised as having a 64-bit processor. Explain what this tells you about its word size.
Show answer
Its word size is 64 bits: the CPU works on 64 bits of data in a single operation, and its registers are 64 bits wide.
5. A memory has 20 address lines and a word size of 8 bits. Calculate its capacity in MB.
Show answer
220 = 1,048,576 locations × 1 byte = 1,048,576 bytes = 1 MB.
6. Explain why the start-up program of a computer is stored in ROM or flash memory and not in RAM.
Show answer
RAM is volatile, so it is empty when the computer is switched on. The start-up program must already be in memory at power on, so it is kept in non-volatile memory (ROM or flash), which keeps its contents without power.
7. Explain how static RAM and dynamic RAM store a bit, and why cache memory uses static RAM.
Show answer
Static RAM stores each bit in a flip-flop; dynamic RAM stores it as a charge on a capacitor that must be refreshed. Static RAM is faster (no refresh), which is what cache needs, even though it costs more per bit.
Homework
- Make a table that compares RAM, ROM, EPROM and EEPROM under these headings: read/write, volatility, how it is erased, one use.
- Find the RAM size and the word size (32-bit or 64-bit) of a computer or phone at home. Write down where you found the information.
Mastery quiz: Memory Types and Features
Your course badges: loading saved progress…
View badges
No course badges earned yet. Score 8/10 in a lesson quiz to earn its badge.
Saved in this browser on this device. Clearing browser data may remove your badges.
Answer all 10 questions. Earn this lesson’s badge at 8/10 or higher. Read the explanations, revisit the Try it activities and retry as often as you need. These are self-study badges, not formal grades.
Exam tips
- Specimen Unit 1 Paper 01 (2021), Items 4, 5, 7 and 8. Four multiple-choice items on this lesson, all with syllabus reference 1.1 (Module 1). Item 4 is about what cache memory is for, Item 5 is about the meaning of word size, Item 7 is about which memory family flash memory belongs to, and Item 8 is about which memory or storage device is slowest to access. They test whether you know the definitions exactly and can rank devices by speed (registers, cache, RAM, then storage). Read every option before you choose, because a wrong option is often a true statement about a different part of the computer. Open the specimen paper and try all four items before you check the answer key.
- Specimen Unit 1 Paper 02 (2021), Question 2(a). This part asks you to tell two pairs of memory types apart, ROM and RAM, then EPROM and EEPROM, with 2 marks for each pair. It tests whether you can make a clear contrast. Make one point about each item, on the same feature (for example whether it can be written to, or how it is erased), so that each half of your contrast can earn a mark. A point about only one of the two items cannot earn both marks. Try it on paper, then compare with practice questions 1 and 2 above.
- 2024 Unit 1 Paper 02, Question 1(b). Two parts that compare devices on named features: a hard disk with RAM (access method and access speed), and RAM with a flash drive (volatility and portability), 3 marks each. It tests whether you can apply the memory features to real devices. Cover every named feature for both devices, use the feature words in your answer, and give a reason (for example, moving parts make a hard disk slower). Try it first, then read the solution on this site: 2024 U1 Q1. See also Serial, Sequential, Direct (Random) Access.
- More worked answers are on the CS Solutions page.
Try it 6Quick quiz
Tap an answer. All the questions are self-checks on this lesson.
Background: Flip Flops, The SR Flip-Flop – Practical Introduction and The SR Latch. Next: registers and the CPU (coming soon in this course). For a first look at how the CPU uses its registers to fetch instructions from memory, see 2009 U1 Q2 Part C and part (a) of 2024 U1 Q1.
Syllabus link: CAPE Computer Science (CXC A19/U2/21), Unit 1, Module 1: Computer Architecture. Specific Objective 1: state the purpose of the main components of a computer system (memory types: ROM, RAM, EPROM, EEPROM; memory features: speed, size, word size, volatility). U1 M1 SO1.
Attributions to media used in this post:
EPROM chip photo: Anonimski, CC BY-SA 3.0, via Wikimedia Commons (File:EPROM AM27C256DC.jpg).
Updates
7 Nov 2026: Added the shared course badge summary and lesson mastery quiz, with feedback, retries and browser-saved progress.
27 Oct 2026
- Draft created.
28 Oct 2026
- Exam references reworded and quiz questions rewritten.
© 2026 Vedesh Kungebeharry. All rights reserved.
[…] lesson follows on from Memory Types and Features. If you did CSEC, Inside the Computer: Input, Processing, Memory, Storage and Output (IPOS) is a […]