Data Representation

Advanced

Computers store all data in binary: a bit is 0 or 1, eight bits make a byte; numbers use binary and hexadecimal, text uses ASCII and Unicode. Mastering base conversion and encoding reveals how data really looks inside a computer.

For:Secondary 4 Information & Communication Technology · Unit:Information processing · Lesson 2 of 6 in the learning path

After this lesson, you can:
  • Computers represent all data in binary: a bit is 0 or 1, eight bits make a byte
  • Storage units grow by 1024: byte, KB, MB, GB, TB
  • Binary and hexadecimal convert in groups of four bits from the right; decimal conversion uses place values or repeated division
文體:科技知識說明文有聲朗讀

文體小知識:科技知識說明文——講解電腦如何以二進制表示數據,位元與位元組的關係,二進制、十進制與十六進制的互換,以及字符編碼的原理。

資訊及通訊科技Information & Communication Technology
Before this lesson you should know: Data and Information

§Text Passage

1A computer is built from vast numbers of electronic switches, each with only two stable states — on and off, represented by 1 and 0 — so all data inside a computer is ultimately binary. One binary digit is a bit, the smallest unit of storage; eight bits form a byte, giving 256 different combinations, just enough to represent one basic character.

2Storage capacity builds up from the byte: 1024 bytes make a KB, 1024 KB make a MB, then come GB and TB. Integers are stored in binary — five bits, for example, represent 0 to 31. To write long binary numbers conveniently, engineers use hexadecimal with digits 0–9 and A–F, and each hexadecimal digit corresponds to exactly four bits.

3Text must also be represented numerically. ASCII assigns each character a numeric value: capital A is 65, lowercase a is 97, and the digit symbol 0 is 48; the standard 7-bit code covers 128 characters. Unicode gives every character in every language a unique number, covering Chinese characters, Japanese text and emoji, and has become the mainstream encoding of modern systems.

4Images are made of pixels, and each pixel's colour is stored as binary values — for example, three bytes recording the intensity of red, green and blue. Sound is digitised by sampling the wave amplitude at fixed intervals. The more bits used per pixel or per sample, the higher the quality and the larger the file — which is why HD videos run to GB, and why binary underpins all multimedia data.

1Summary 重點摘要

Computers store all data in binary: a bit is 0 or 1, eight bits make a byte; numbers use binary and hexadecimal, text uses ASCII and Unicode. Mastering base conversion and encoding reveals how data really looks inside a computer.

2Vocabulary cards Vocabulary

b
bit位元

The smallest unit of data in a computer, holding either 0 or 1.

b
byte位元組

A group of 8 bits able to represent 256 different values; the basic unit of storage.

b
binary二進制

The base-2 number system using only 0 and 1, the form in which computers store all data.

h
hexadecimal十六進制

The base-16 system using 0–9 and A–F; one hexadecimal digit stands for exactly four bits.

k
kilobyte (KB)千位元組

A storage unit equal to 1024 bytes.

c
character encoding字符編碼

The scheme that assigns a numeric value to each character so text can be stored digitally.

A
ASCII美國信息交換標準碼

A 7-bit character code assigning values such as 65 for capital A, covering 128 characters.

U
Unicode統一碼

An encoding giving every character in every language a unique number, including Chinese characters and emoji.

p
pixel像素

The smallest unit of a digital image, its colour stored as binary values.

s
sampling取樣

Measuring a sound wave's amplitude at fixed intervals to turn sound into a sequence of numbers.

3Step by step Steps

  1. Step 1: Bits and bytesA computer's memory is built from hundreds of millions of electronic switches, each with two stable states — on (1) and off (0) — so all data ultimately becomes binary. A bit is the smallest unit; eight bits form a byte, giving 2 to the power of 8, i.e. 256 combinations. For example, one byte can represent exactly one ASCII character — the reason storage units are built on the byte.
  2. Step 2: Binary to decimalEach binary position has a place value — 1, 2, 4, 8, 16 and so on from right to left; add the place values of the 1 bits to get the decimal value. For example, 10110110 has place values 128, 64, 32, 16, 8, 4, 2, 1; the 1 bits contribute 128, 32, 16, 4 and 2, totalling 182, so 10110110₂ = 182₁₀. Write out the place values first and align each digit — mistakes then become rare.
  3. Step 3: Decimal to binaryUse repeated division by 2: keep dividing, record each remainder until the quotient is 0, then read the remainders bottom-up. For example, to convert 45: 45 ÷ 2 = 22 remainder 1, 22 ÷ 2 = 11 r 1, 11 ÷ 2 = 5 r 1, 5 ÷ 2 = 2 r 1, 2 ÷ 2 = 1 r 0, 1 ÷ 2 = 0 r 1; reading bottom-up gives 101101. Check: 32 + 8 + 4 + 1 = 45 — correct.
  4. Step 4: Binary and hexadecimal conversionHexadecimal uses 0–9 and A–F (A to F standing for 10 to 15), and each digit maps to exactly four bits, so convert by grouping four bits from the right. For example, split 10110110 into 1011 and 0110: 1011 is 11, written B, and 0110 is 6, giving B6. Conversely, 3D splits into 3 and D: 3 is 0011 and D (13) is 1101, joining to 00111101.
  5. Step 5: Storage unitsCapacity builds up from the byte: 1024 bytes make a KB, 1024 KB a MB, 1024 MB a GB, and 1024 GB a TB. For example, a photo is about three MB, a ten-minute HD video about five hundred MB, and a whole film runs to GB. Knowing the ladder lets you estimate how many files fit on a drive or in cloud storage — and in exercises remember the factor is 1024, not 1000.
  6. Step 6: ASCII character codingASCII uses seven bits to code 128 characters: digits 0 to 9 are 48 to 57, capitals A to Z are 65 to 90, lowercase a to z are 97 to 122. For example, A is 65, which in binary is 1000001, padded to eight bits as 01000001; because the codes run consecutively, knowing C is 67 gives F as 67 + 3 = 70. Ordering and case conversion both rely on these patterns.
  7. Step 7: Unicode and multimediaASCII covers only English characters and cannot hold the tens of thousands of Chinese characters; Unicode gives every character worldwide a unique number, including Chinese, Japanese and emoji, and is the standard in modern operating systems and web pages. For example, a Chinese-English document saved in Unicode shows no garbled text. For images, each pixel stores its colour in several bits — more bits mean richer colour and larger files.

5Worked example Example

A computing notebook has three conversion questions: convert binary 10110110 to decimal and to hexadecimal; convert hexadecimal 2C to decimal; and write down the ASCII code of the letter A together with its 8-bit binary form. Solve step by step.

  1. Binary to decimal: write the place values 128, 64, 32, 16, 8, 4, 2, 1; the 1 bits of 10110110 contribute 128, 32, 16, 4 and 2, giving 128+32+16+4+2 = 182.
  2. Binary to hexadecimal: group four bits from the right — 1011 and 0110; 1011 is 11, written B, and 0110 is 6, so 10110110₂ = B6₁₆.
  3. Hexadecimal to decimal: in 2C the digit 2 sits in the sixteens place and C (12) in the units place, so 2×16+12 = 44.
  4. Letter A: its ASCII value is 65; by place values 64+1 = 65, the binary form is 1000001, padded to eight bits as 01000001.
  5. Answer: 10110110₂ = 182₁₀ = B6₁₆; 2C₁₆ = 44₁₀; the letter A has ASCII value 65 and 8-bit binary form 01000001. Key techniques: group four bits from the right for binary-to-hexadecimal; expand hexadecimal by place values 16 and 1; for character codes remember capitals start at 65, convert by place values and pad to eight bits.

6Common mistakes Mistakes

✗ Believing one KB equals 1000 bytes.
✓ Storage is binary-based: one KB equals 1024 bytes, not 1000.
✗ Grouping from the left, or in threes, when converting binary to hexadecimal.
✓ Group four bits starting from the right, padding zeros on the left if needed — e.g. 110 becomes 0110.
✗ Assuming ASCII can encode every Chinese character.
✓ ASCII has only 128 characters, all English letters and common symbols; Chinese needs Unicode.
✗ Writing A's code as 65 and calling it binary.
✓ 65 is the decimal value; the binary form is 01000001 — read carefully which base the question asks for.

7Quick check Quick check

Q1How many bits are in a byte, and how many combinations can it represent?

Q2Convert binary 110101 to decimal.

Q3Convert decimal 200 to hexadecimal.

Q4What is the ASCII value of capital E? (Hint: A is 65)

Q5Why do computers use binary rather than decimal?

8Recap Recap

  • Computers represent all data in binary: a bit is 0 or 1, eight bits make a byte
  • Storage units grow by 1024: byte, KB, MB, GB, TB
  • Binary and hexadecimal convert in groups of four bits from the right; decimal conversion uses place values or repeated division
  • ASCII codes English characters numerically (A is 65); Unicode covers all characters including Chinese
  • Images are made of pixels, sound is digitised by sampling — all ultimately binary

Other subjects in this grade

Same subject, other grades