0%

Chapter 2

How Data Becomes Work

Bits, Bytes, and File Sizes

What are instructions and data actually made of?

At the bottom, computer represents information using components with two reliably distinguishable states. We write those states as 0 and 1, call each choice a bit, and group bits into bytes so we can talk about useful amounts of data.

From one bit to one byte

A bit, short for binary digit, has two possible values: 0 or 1. Those symbols are a convention. Inside real hardware the distinction might be a voltage range, an electric charge, the direction of a magnetic field, or the presence of light. Nothing contains a tiny printed zero; it contains a physical state that the hardware can distinguish from another one.

Combining bits creates more possible patterns. This course will not ask you to do binary arithmetic. The relationship you need is that eight bits form one byte, and one byte can hold 256 distinct patterns.

A byte pattern does not carry its own meaning. The same pattern might represent part of a number, a shade of color, a moment of sound, a machine instruction, or a letter. Software and file formats decide how to interpret it.

The byte 01000001 appears in a file. Which statement is most accurate?

From bytes to file sizes

Files and memory run to enormous numbers of bytes, so the labels get prefixes:

UnitDecimal sizeA rough example
kilobyte, KB1,000 bytesa short plain-text file
megabyte, MB1,000,000 bytesa compressed photo or audio file
gigabyte, GB1,000,000,000 bytesa large application or video
terabyte, TB1,000,000,000,000 bytesa storage drive’s capacity

Those examples are scale comparisons, nothing firmer. A photo can be a tenth of that or fifty times it depending on its dimensions, format, and compression.

For everyday judgment, compare the unit before you compare the digits. A 4 MB photo is about four thousand times the size of a 1 KB text file, and knowing that is almost always enough. You will very rarely need to convert anything to bytes to make a decision.

A folder holds one 3 KB text file and one 6 MB photo. Roughly how much of the folder's total size is the text file?

You can now compare how much data two files hold without converting everything back to bytes. The next question is why one stored sequence of bytes behaves like a program while another sits there as a picture.