☰ Contents · Computing

How a computer represents information

Lessons 9–10 · 2 lessons · B. Boltayev, M. Mahkamov, A. Azamatov, S. Rahmonqulova. Informatics and Information Technologies, Grade 7. Revised and expanded third edition. “O‘zbekiston milliy ensiklopediyasi” State Scientific Publishing House, Tashkent, 2017
9

How a computer represents information

Textbook: pp. 36–42
GoalExplains that a computer codes information in binary, finds the number of codes with N = 2^m, uses ASCII, bit and byte and the units of information volume and transfer speed, and calculates image pixels and colour depth.
New words
bit: one binary digit, 0 or 1 – the smallest unit of information · bitbyte: a group of 8 bits; in the course calculations one character takes 1 byte · baytASCII: a standard code table for letters, digits and signs; each character is stored in 1 byte (8 bits) · ASCIIpixel: the smallest square dot of a picture on the screen · piksel
Explanation

A computer works with electrical signals and easily tells two states apart: a signal is present or not (magnetised or not). By agreement one state is taken as 1 and the other as 0, so numbers, text, pictures and sound are all stored as sequences of 0s and 1s. Uniform coding is normally used: with a code of m binary places we can code N = 2^m different characters; for example 2² = 4, 2³ = 8, 2⁸ = 256. For B characters the needed m is found from 2^(m–1) < B ≤ 2^m (for 20 characters m = 5, because 16 < 20 ≤ 32). Letters, digits and signs are coded with the ASCII table, where each character is stored in 1 byte (8 bits): the letter A is 01000001 (65), B is 01000010 (66). The original ASCII has 128 characters (Latin letters, digits, signs); the other 128 places are used by extended tables, for example for Cyrillic letters. So that letters of all languages, such as Uzbek o‘ and g‘, fit one table, the Unicode table is widely used today, but in calculations 1 character = 1 byte. One place of a code is 1 bit, and 8 bits make 1 byte. Larger units: 1 KB (kilobyte) = 1024 bytes, 1 MB = 1024 KB, 1 GB = 1024 MB (the textbook rule; the textbook writes Kb, Mb, while the international standard uses 1 kB = 1000 bytes and writes 1024 bytes as KiB). Byte is written with a capital B and bit with a small b or “bit”: for example, Internet speed is measured in Mbit/s. Transfer speed is the volume transferred in a unit of time: speed = volume : time. On the screen a picture is made of pixels; in a black-and-white picture each pixel takes 1 bit, and with N colours it takes r bits, where N = 2^r (r is the colour depth). On a computer colours are made as mixtures of red, green and blue (RGB). Sound is also turned from analog to digital: the signal is measured many times per second (sampling).

Worked examples
“HI” in ASCII: H = 72 → 01001000, I = 73 → 01001001. So “HI” = 01001000 01001001: 2 characters, 16 bits, 2 bytes.
A 1024 × 768 screen with 256 colours: 256 = 2⁸, so a pixel takes 8 bits. Volume = 1024 · 768 · 8 bits = 1024 · 768 bytes = 768 KB. A black-and-white 800 × 600 picture: 800 · 600 : 8 = 60000 bytes.
Class activity

“Binary painter”: a small 8 × 8 picture (a heart) is drawn on squared paper; black = 1, white = 0, and 8 bytes are written. A partner restores the picture from the bytes.

Practice
1
How many different characters can a 7-place binary code represent?
2
Code the word “ADA” in ASCII (A = 65, D = 68).
3
A text has 2048 characters. How many KB is its volume?
4
Why does a computer store information in binary?