Computing / Knowledge quiz

Latch vs flip-flop: a quiz on how computer memory holds a bit

A latch vs flip-flop comparison shows that a gated latch accepts input changes during its enabled level while a flip-flop updates only at a clock edge. The quiz covers SR latch operation, gated latch transparency, edge-triggered flip-flop timing, how eight flip-flops form a processor register, random access memory addressing, and the role of a memory address decoder. Try the questions to see how you do.

10 questionsAnswers and score at the end
Practice quiz

Test your knowledge.

Question 1 of 100 answered

Adding up your answers

Your score is next.

Question 1

What does feedback do in a memory circuit?

Feedback allows a circuit to maintain a state after the starting signal ends.

Source excerpt
Instead of the signal just leaving the gate and disappearing, it travels back to the start.

From the Knowverse course text.

Question 2

How much information does a basic S-R latch store?

A latch holds one of two states, representing 0 or 1.

Source excerpt
Because an S-R Latch holds either a 0 or a 1, it is the fundamental building block for storing a single bit of information.

From the Knowverse course text.

Question 3

What input returns a set S-R latch to 0?

Reset changes the stored state back to 0.

Source excerpt
To change this value back to 0, we must use the second input: the Reset signal.

From the Knowverse course text.

Question 4

What does asynchronous mean for a basic S-R latch?

An asynchronous latch reacts to its control inputs without a separate timing clock.

Source excerpt
An asynchronous device does not wait for a special timing signal or a 'clock' to do its job.

From the Knowverse course text.

Question 5

When is the gated latch described in the course transparent?

Transparent means input changes can affect the stored state during the enabled high level.

Source excerpt
In a Gated Latch, the memory is 'transparent' while the clock is High. This means if the inputs change during that time, the memory will change too. We usually try to avoid this by making the 'High' pulse very short.

From the Knowverse course text.

Question 6

What distinguishes a flip-flop from a level-sensitive latch?

An edge-triggered flip-flop samples at a transition instead of throughout an enabled level.

Source excerpt
This new type of circuit is called a Flip-Flop. Unlike a latch, it is edge-triggered.

From the Knowverse course text.

Question 7

How many flip-flops are needed to hold one eight-bit byte?

Each flip-flop holds one bit, so eight are needed for a byte.

Source excerpt
No, a single Flip-Flop can only ever store one bit (a 0 or a 1). To store more data, like a byte, you have to line up eight Flip-Flops side-by-side and trigger them with the same clock signal.

From the Knowverse course text.

Question 8

Where is a processor register located?

Registers hold data close to the processor operations that use it.

Source excerpt
This 'countertop' in a computer is called a register. It is a small, specialized storage location built directly into the processor's heart to hold data during a calculation.

From the Knowverse course text.

Question 9

What does random access mean in RAM?

Addresses let the computer select a location directly.

Source excerpt
The 'Random' part means you don't have to start at the beginning and search through every cell to find what you need.

From the Knowverse course text.

Question 10

What does a memory address decoder do?

A decoder converts an address pattern into selection of a particular output.

Source excerpt
A Decoder is a logic circuit that takes a binary address as input and activates exactly one output line.

From the Knowverse course text.

YOUR SCOREcorrect answers
Quiz complete

Here's how you did.

See the answer and explanation for each question below.

Knowverse app icon
KNOWVERSE FOR IPHONE

Get the Knowverse app.

Find more quizzes and full courses in the free iOS app.

Get KnowverseDownload on iOS

Holding a bit and timing an update

A basic logic gate responds to its current inputs. Feedback sends an output back into the circuit, allowing a stored state to persist after the initiating signal stops. An S-R latch uses Set and Reset inputs to hold a single bit. It keeps that state while power remains available.

Timing becomes important when several signals travel through different paths. A gated latch accepts changes during its enabled level, whereas a flip-flop updates at a clock edge. That distinction gives a circuit control over when data enters memory. Inputs still need time to settle around the sampling instant.

Source excerpt
Chapter: The Concept of Feedback A doorbell only makes a sound for as long as your finger is physically pressing the button. As soon as you pull your hand away, the circuit breaks and the sound stops immediately. This is how most basic electronic components work: they respond to what is happening right now. Standard logic gates are naturally momentary; they don't have a way to remember what happened a second ago. To fix this, engineers use a trick called a feedback loop. Instead of the signal just leaving the gate and disappearing, it travels back to the start. This creates a circle where the gate can actually talk to itself. Both the external user and the gate itself. Once the gate turns on, it provides its own input signal to stay on. When a circuit uses a loop to hold its state, we call this persistence. Let's look at a concrete example using an OR gate and a single feedback wire. The circuit has successfully remembered that you pressed the button, even though you aren't pressing it anymore. We would need to physically cut the power or add a second gate to 'break' the loop. A simple OR gate loop stays on forever once triggered. This ability to stay 'on' without help is the fundamental building block of computer memory. Next, we will look at how to build a circuit that can be both 'set' to on and reset to off. Yes, you can connect the output of any gate back to its input. However, different gates produce different results. For example, an OR gate loop can stay 'on' forever, while a NOT gate loop would constantly flip between 'on' and 'off'. Not significantly. It uses the same amount of power as any other active gate in the circuit. The 'cost' is simply the space for the extra wire and the gate itself. As long as the circuit has power, yes. However, if you turn off the computer or cut the power, the electricity stops flowing, the loop breaks, and the 'memory' is lost. This is why your computer's RAM clears when you restart. Not exactly. Hard drives use a different technology (like magnetism) to store data without power. The persistence we are talking about here is 'volatile' memory, which needs active electricity to keep the feedback loop running. An OR gate is the easiest to understand for persistence. Since it only needs *one* input to be '1' to stay 'on', it can easily 'hold' itself on. An AND gate would require *both* inputs to be '1', which makes the feedback logic slightly more complex to start. Chapter: The S-R Latch When you press a key on your keyboard, the computer needs to remember that specific action even after your finger leaves the button. Standard logic gates like AND or OR only produce an output as long as the inputs are active; once the input disappears, the output usually disappears too. To solve this, we use a specific circuit called the S-R Latch, which is the most basic form of computer memory. Let's look at how the Set operation works in a real scenario, such as turning on a security alarm. Even if you stop sending the signal to the Set input, the output stays at 1 because the circuit is now 'latched' onto that value. The output remains 1. The circuit has 'remembered' the last command through its internal feedback. To change this value back to 0, we must use the second input: the Reset signal. Now the circuit is back to its original state, waiting for the next Set command. One unique characteristic of the basic S-R Latch is that it is asynchronous. An asynchronous device does not wait for a special timing signal or a 'clock' to do its job. The moment you change the input, the output reacts. There is no waiting period. While being asynchronous makes the latch very fast, it can also lead to problems in complex systems where many parts need to work together in perfect timing. Immediately at 12:00:00 (plus a tiny fraction of a second for the gates to flip). It doesn't wait for a 'next step'. The reason the S-R Latch works is because of the feedback loop we discussed previously. Because an S-R Latch holds either a 0 or a 1, it is the fundamental building block for storing a single bit of information. By combining thousands or millions of these latches, computers can store everything from your text messages to complex software. Before we finish, let's test your understanding of how these two inputs interact to manage memory. In a basic S-R Latch, this is called an invalid state. The circuit's gates will compete with each other, and the resulting output might be unpredictable or logically inconsistent. In real-world design, engineers use extra gates to prevent this from happening. No. The S-R Latch is volatile memory. It requires a constant flow of electricity to maintain the feedback loop. Once power is lost, the loop breaks, and the stored bit is gone forever. A standard S-R Latch can be built using just two cross-coupled NOR or NAND gates. This simplicity is why they are used by the millions in digital systems. While they are fast, they are very hard to synchronize. In a modern CPU, billions of operations must happen in a specific order. Without a clock to keep everything in 'harmony,' the different parts of the computer would get out of sync, leading to data errors and crashes. It is a relative. Static RAM (SRAM) uses a more complex version of the latch to store data. While the S-R Latch is the simplest version, the core principle of using feedback to store a bit is exactly how high-speed cache and RAM work. Chapter: Clocking the Memory In a computer, electrical signals do not move between components instantly. Electricity travels through wires and logic gates at a finite speed, which creates tiny delays. Imagine you are trying to store a 2-bit number, but the first bit travels through a longer wire than the second bit. The memory might see one bit change before the other, causing it to store a wrong temporary value. We introduce a control signal that tells the memory exactly when to pay attention and when to ignore the inputs. This control signal is produced by a specialized circuit called the Clock. A clock does not carry data; instead, it produces a steady, repeating pulse. This pulse is a signal that constantly flips between a High (1) state and a Low (0) state. To fix our timing problem, we combine this clock signal with the S-R Latch we learned about earlier. This new circuit is called a Gated Latch because the clock acts like a gatekeeper. We use AND gates to control whether the Set (S) and Reset (R) signals can actually reach the memory. This 'frozen' state is vital because it gives the input signals time to stabilize. While the clock is Low, the rest of the computer can change its signals without corrupting the stored memory. Let's walk through a specific example of updating a Gated Latch. Imagine the latch currently stores a 0, and we want to change it to a 1. First, we set the 'Set' input to High (1). However, the Clock signal is currently Low (0). Because the Clock is Low, the AND gate blocks the 'Set' signal. The memory remains 0. Now, the Clock signal pulses to High (1). Both inputs to the 'Set' AND gate are now 1. The signal passes through, the feedback loop triggers, and the memory value finally becomes 1. By using a clock, we have created synchronization. Every component in the computer now knows exactly when to listen and when to hold its value. If the clock pulses before the input signals have finished traveling through the wires (stabilizing), the memory might 'sample' a messy or incorrect value. This is why computers have a maximum 'clock speed' they can safely handle. Yes! Modern computers often have multiple clocks. The main CPU might have a very fast clock, while the parts that talk to the mouse or keyboard use a much slower clock to save power and match the speed of those devices. The term comes from the idea of a physical door latch. It 'latches' onto a value and holds it tight until it is told to let go and latch onto a new one. In a Gated Latch, the memory is 'transparent' while the clock is High. This means if the inputs change during that time, the memory will change too. We usually try to avoid this by making the 'High' pulse very short. Exactly. Physically, it's just a wire that switches between 0 volts and a higher voltage (like 3.3V or 5V). The logic gates don't know it's a 'clock'; they just treat it as another binary input. Chapter: The Flip Flop A clock signal in a computer isn't just a single point in time; it is a pulse that stays 'on' for a specific duration. When this signal is 'High', it acts like a green light for data to flow into a memory circuit. In previous chapters, we looked at the S-R Latch, which stores a bit as long as the clock signal remains active. Imagine a processor trying to add two numbers. If the result changes while the clock is still 'High', the latch might capture a half-finished calculation. The Transition. This is the only way to ensure we capture a single, stable snapshot of the data. To solve this, engineers created a circuit that ignores the 'High' state and only reacts to the edge of the signal. This new type of circuit is called a Flip-Flop. Unlike a latch, it is edge-triggered. The term edge-triggering means the circuit only updates its internal state during that tiny fraction of a second when the clock changes. The most common version is the D-type Flip-Flop, where 'D' stands for Data. This behavior prevents data racing, where signals move too quickly through the system and cause errors. By using edge-triggering, computers can synchronize billions of Flip-Flops to update their state at the exact same moment. This synchronization is what allows a processor to perform complex math without the bits getting 'lost' or 'overlapping'. In a way, yes. A Flip-Flop is often built using two latches connected in a 'Master-Slave' configuration. This extra complexity is what allows it to be edge-triggered rather than level-triggered, providing much better control over timing. It is technically possible, but generating and distributing perfectly sharp, ultra-short pulses across a whole computer chip is extremely difficult. It's much more reliable to use a standard clock wave and let the Flip-Flop's internal logic handle the precise timing. No, a single Flip-Flop can only ever store one bit (a 0 or a 1). To store more data, like a byte, you have to line up eight Flip-Flops side-by-side and trigger them with the same clock signal. This can cause a problem called 'metastability,' where the Flip-Flop gets confused and can't decide between 0 or 1 for a short time. Engineers design systems to ensure data is stable shortly before and after the edge to avoid this. Absolutely. Flip-Flops are the fundamental building blocks of almost everything inside a CPU, including the registers and the control logic. Without them, modern high-speed computing would be impossible.

From the Knowverse course text.

Modern Memory — image from Wikimedia Commons
Random Access Memory HyperX · Zsinytwiki · CC0

From registers to addressed memory

Registers group bits inside the processor for use during calculations. Eight flip-flops can form an eight-bit register, holding a pattern from 00000000 to 11111111. The pattern can represent a number or another kind of data. Registers provide a small working space close to the operations using them.

RAM provides a larger workspace with addresses that identify storage locations. Random access means a chosen location can be reached without reading every earlier location first. A decoder translates a binary address into a selected output line. RAM is volatile, so data needed after power loss must be saved in non-volatile storage.

Source excerpt
Chapter: Registers When a computer's processor needs to add two numbers, it cannot afford to wait for data to travel from a distant storage location. It needs a place to hold those numbers immediately so it can work on them without any delay. Think of the processor as a high-speed chef. If the ingredients are in a pantry down the hall, the chef spends more time walking than cooking. To solve this, we put a small workspace directly on the counter. This 'countertop' in a computer is called a register. It is a small, specialized storage location built directly into the processor's heart to hold data during a calculation. By grouping flip-flops together, the register acts as a single container. If you have eight flip-flops wired together, you have an 8-bit register that can store any number from 0 to 255. Because registers are physically located inside the processing area, electricity has almost no distance to travel. This makes them the fastest form of memory in the entire computer. Physical space is limited. The processor is tiny, and we can only fit a very small number of registers inside that 'hot zone' before it becomes too crowded or hot. A register is the ultimate performance tool. It takes the simple ability of a flip-flop to store one bit and scales it up to handle the numbers that make software run. Registers are extremely fast but also very 'expensive' in terms of physical space on the processor chip and the heat they generate. If we tried to make a register the size of your RAM, the chip would be too large to manufacture and would melt from the heat. They are related, but a register is more advanced. While a latch can store a bit, a register is a collection of flip-flops (which are synchronized by a clock) that work together to store a multi-bit number at a specific moment. Not necessarily. '64-bit' usually refers to the size of each register (meaning each one can hold a 64-bit number), not the total count of registers. A processor might have dozens of these 64-bit registers. The data is lost. Registers are made of electronic circuits that require constant power to maintain the 'feedback loops' that hold the bits. This is why you must save your work to a hard drive for permanent storage. Yes! In a computer, everything is binary. A register holds a pattern of 1s and 0s. That pattern might represent a number (like 65), but the computer can also interpret that same pattern as a letter (like 'A') or a color. Chapter: Random Access Memory A computer doesn't just need to store one or two numbers; it needs to hold millions of them at once to run a modern program. While registers are incredibly fast, they are physically too large and expensive to be used for storing everything your computer is currently doing. Random Access Memory, or RAM, is a giant collection of memory cells where any single piece of data can be reached instantly. The 'Random' part means you don't have to start at the beginning and search through every cell to find what you need. To find a specific cell in this massive warehouse, every single byte of memory is assigned a unique address. An address is just a binary number that identifies exactly where a piece of information is located. Think of it like a giant wall of mailboxes; if you know the box number, you can go straight to it without checking the others. We would have to check 999,998 other items first. This is why 'Random Access' via addresses is so much faster. There is a catch to this fast, organized memory: it is volatile. Volatile memory requires a constant flow of electricity to keep its 'mailboxes' filled with data. If you turn the power off, the electrical charges that represent your binary digits simply disappear. This is why your computer 'boots up' when you turn it on; it has to move data from permanent storage back into the empty RAM. So, RAM gives us a massive, fast workspace where every byte has a unique address, but it only works as long as the lights are on. The main reason is volatility. If your hard drive was made of RAM, you would lose every photo, document, and app every time you turned off your computer. Additionally, RAM is much more expensive per gigabyte than traditional hard drives or SSDs. Not exactly, but you can have 'more than you need.' If your programs only use 4GB of data and you have 32GB of RAM, the extra 28GB just sits there empty. It doesn't make the computer faster; it just means you have a much larger 'workspace' available if you decide to open more apps. It's all about the number of unique IDs. A 32-bit address can only identify about 4 billion unique locations (4GB). A 64-bit address can identify quintillions of locations, which is why modern computers can use 16GB, 32GB, or even 1TB of RAM. No, it's a bit of a confusing name! It means the computer can access any 'random' location you choose just as quickly as any other. It refers to the freedom of movement, not to mathematical randomness or luck. When your RAM (the 'workbench') gets full, the computer has to start moving data back and forth to the much slower hard drive to make room. This 'swapping' process is thousands of times slower than RAM, which causes the lag you feel. Chapter: The Memory Address Decoder Computers manage millions of individual storage cells, yet the processor must be able to pinpoint and communicate with just one specific byte at any given moment. To achieve this, every memory location is assigned a unique binary address, which acts as a digital identifier for that specific spot. The Bus is not just a single wire; it is a collection of multiple parallel wires that carry electrical signals simultaneously. When the CPU wants to read data, it places a binary pattern on the address bus wires. For example, if the address bus has 8 wires, the CPU can send any combination of 8 bits, such as 10100011. However, simply having the address on the bus isn't enough. We need a way to translate that binary pattern into a physical 'on' signal for one specific memory cell. If we didn't have a specialized circuit, we would need a separate wire for every single byte in memory, which is physically impossible for millions of bytes. The physical space required for a million wires would make the processor and the circuit board massive and impossible to manufacture. This is where the Memory Address Decoder comes in. It acts as the bridge between the small number of bus wires and the large number of memory locations. A Decoder is a logic circuit that takes a binary address as input and activates exactly one output line. Think of it as a translator: it reads the binary 'code' on the input side and flips a single switch on the output side. Every combination of inputs results in a different Output Line being turned on. The most important rule of a decoder is exclusivity: one, and only one, output line can be active at any time. Two different memory locations would try to send their data onto the bus simultaneously, causing electrical interference and corrupted data. To ensure this exclusivity, the decoder is built using a combination of AND gates and NOT gates. Recall that an AND gate only outputs a 'High' signal if all of its inputs are 'High'. By using NOT gates to flip certain signals before they reach the AND gates, we can create a unique condition for every possible binary input. For the address 00, the decoder uses NOT gates to turn both zeros into ones. These ones then enter an AND gate, which finally outputs a 'High' signal. Because the other AND gates are wired differently, they will see at least one '0' and remain 'Low'. As we add more wires to the address bus, the decoder simply grows in size, adding more AND gates to handle the new combinations. A standard modern computer might use a 32-bit or 64-bit address bus, requiring a massive decoder to manage billions of locations. This efficiency is what makes Random Access Memory (RAM) possible. We don't have to wait for a signal to travel through every cell; the decoder jumps straight to the target. Every time your computer opens a file or runs a program, billions of these decoding operations happen every second. Without the Decoder, the CPU would be like a speaker who knows the name of a person in a crowd but has no way to point them out. By combining the transport power of the Bus and the selection logic of the Decoder, the computer creates a perfectly organized system for instant data retrieval. It is called a decoder because it 'decodes' a compressed binary number (the address) into a single, uncompressed physical signal. It takes the code and reveals the specific location it represents. In some specialized designs, they are 'multiplexed,' meaning the wires carry an address for one moment and data the next. However, in most high-performance systems, they are separate to allow the CPU to work faster. Typically, the main address decoder is located on the memory module itself. The CPU sends the address out, and the memory's internal circuitry decodes it to find the right cell. The decoder would fail to identify addresses correctly. It might activate the wrong line, no lines at all, or multiple lines, leading to a 'Blue Screen' or a total system crash. No. They are independent. A computer might have a 32-bit address bus (to reach 4GB of memory) but a 64-bit data bus (to move 8 bytes of data at a time). Chapter: Read and Write Operations When you achieve a new high score in a video game, the computer must perform two distinct tasks to manage that information. First, it has to update the old record with your new, higher number. This is a Write operation. Later, when you restart the game, the computer must look up that score to show it on the screen. This is a Read operation. Writing is the process of putting new information into a specific storage location. When the computer writes, it sends a binary value to a location and forces the electronic gates there to match that value. A key characteristic of writing is that it is destructive to whatever was there before. If a memory slot held the binary for the number '5' and you write the binary for '10' into it, the '5' is permanently lost. This is often called overwriting. The new electrical state simply replaces the old one. No. Writing to an address replaces the existing data. To keep both, you must write the new data to a different, empty Memory Address. Reading is the opposite process: retrieving data from a location so the computer can use it. Unlike writing, reading is non-destructive. The data remains in the memory slot even after you look at it. Think of it as looking at a sign on a wall. You see the information, but the sign doesn't disappear just because you read it. Recall that memory is built from logic gates. The 'Write Enable' signal acts like a master switch for these gates. When the switch is OFF, the gates hold their state. When the switch is ON, the gates are forced to flip to match the incoming binary digits. Understanding these operations is essential because every action a computer takes involves moving data between the processor and Memory Addresses. Whether you are saving a file or just moving your mouse, the system is constantly performing these silent Read and Write cycles. Generally, no. Standard memory cells have a single set of access lines. The system must coordinate so that it is either in 'Read mode' or 'Write mode' at any given instant to avoid electrical conflicts. Reading is much 'gentler' electronically. It involves sensing a voltage without forcing a change in the circuit's state. Writing involves applying a stronger force to flip the logic gates, which, in some types of storage (like Flash), can eventually cause physical wear over millions of cycles. The CPU will still receive a binary value, but it will be 'garbage' data—essentially random 1s and 0s left over from when the computer was turned on or from a previous program. In many modern RAM types, they are roughly the same speed. However, in other storage types like SSDs or SD cards, writing can be significantly slower than reading because of the complex process needed to clear old data before new data can be stored. It would be a 'Read-Only' system. It could perform tasks based on pre-installed instructions, but it could never learn, save your progress, or even perform basic math where the result needs to be stored. It would be functionally frozen in time.

From the Knowverse course text.

Sources

Sources: Memory and Storage. Each question or step includes an excerpt from the course.