Information representation
Cambridge AS & A Level Computer Science 9618 · Paper 1 · Unit 1
Paper 1 · Unit 1. Number representations, multimedia and compression: calculations here are reliable marks.
1. Binary and decimal prefixes
Decimal prefixes go up in powers of 10; binary prefixes go up in powers of 2. Storage is often sold in decimal units, but computers measure in binary units, which is why a “1 TB” drive shows less than 1 TiB.
| Decimal prefix | Value | Binary prefix | Value |
|---|---|---|---|
| kilo (kB) | 10³ = 1000 bytes | kibi (KiB) | 2¹⁰ = 1024 bytes |
| mega (MB) | 10⁶ bytes | mebi (MiB) | 2²⁰ = 1 048 576 bytes |
| giga (GB) | 10⁹ bytes | gibi (GiB) | 2³⁰ = 1 073 741 824 bytes |
| tera (TB) | 10¹² bytes | tebi (TiB) | 2⁴⁰ bytes |
2. Number systems and representations
| Representation | How it works | Example (8 bits) |
|---|---|---|
| Unsigned binary | Base 2; positive whole numbers only, 0 to 255 | 46 = 0010 1110 |
| Hexadecimal | Base 16; one hex digit = 4 bits | 46 = 2E |
| One’s complement | Negative = invert every bit of the positive value; range −127 to +127, with two zeros | −46 = 1101 0001 |
| Two’s complement | Most significant bit is negative (−128); negative = invert and add 1; range −128 to +127 | −46 = 1101 0010 |
| BCD | Each denary digit stored separately in 4 bits | 46 = 0100 0110 |
Try it: one number, every representation
3. Binary addition, subtraction and overflow
Add binary numbers column by column, carrying 1 when a column totals 2 or 3. To subtract, add the two’s complement of the number being subtracted: 20 − 7 = 20 + (−7) = 0001 0100 + 1111 1001 = 0000 1101 (13), ignoring the final carry out.
Overflow happens when a result is too large (or too negative) to be stored in the available bits. In two’s complement it shows when adding two positives gives a negative result, or two negatives give a positive result: for example 100 + 50 = 150, which is outside −128 to +127.
4. Uses of BCD and hexadecimal
- BCD: digital displays such as clocks and calculators, where each digit is shown separately; financial and banking systems, where denary values such as currency must be stored exactly without rounding errors.
- Hexadecimal: memory addresses and dumps, HTML/CSS colour codes, MAC addresses, error codes. It is shorter than binary and easier for people to read and check.
5. Character sets
| Character set | Bits per character | Characters | Notes |
|---|---|---|---|
| ASCII | 7 | 128 | English letters, digits, punctuation and control codes |
| Extended ASCII | 8 | 256 | Adds accented letters and symbols |
| Unicode | Up to 32 (variable, e.g. UTF-8) | Over a million | Every writing system and emojis; the first 128 codes match ASCII |
Character codes are consecutive, so ‘B’ is one more than ‘A’. You do not need to memorise any codes.
6. Bitmap images
A bitmap is a grid of pixels; each pixel’s colour is stored as a binary value. The file header stores data about the image, such as its width, height, colour depth and file type.
| Term | Meaning |
|---|---|
| Image resolution | The number of pixels in the image (width × height) |
| Screen resolution | The number of pixels a screen can display |
| Colour depth / bit depth | The number of bits per pixel: n bits give 2ⁿ colours |
File size (bits) ≈ width × height × colour depth, plus the header. Increasing resolution or colour depth improves quality but increases file size.
7. Vector graphics
A vector graphic stores an image as a drawing list: a set of commands that define drawing objects (lines, circles, rectangles, text). Each object has properties, such as position, size, line colour, fill colour and line thickness.
| Use a bitmap when… | Use a vector when… |
|---|---|
| The image is a photograph or has complex colour changes | The image is made of shapes, e.g. a logo, diagram or icon |
| Every pixel needs to be edited | It must be resized without losing quality |
| A small file is needed for a simple image |
8. Sound
Sound is an analogue wave. To store it, an analogue-to-digital converter samples the amplitude at regular intervals.
- Sampling rate: the number of samples per second (Hz). Higher = more accurate, larger file.
- Sampling resolution: the number of bits per sample. Higher = more accurate amplitude, larger file.
File size (bits) = sampling rate × sampling resolution × length (s) × channels.
Try it: file size calculator
9. Compression
| Lossy | Lossless | |
|---|---|---|
| How | Permanently removes data that is less noticeable | Reduces size without losing any data; the original is rebuilt exactly |
| Examples | JPEG photos, MP3 audio, streamed video | RLE, PNG, ZIP, FLAC audio |
| Use when | Small files matter more than perfect quality, e.g. streaming | Every bit must be kept, e.g. text, program files, medical images |
How each type of file can be compressed
- Text: lossless only, e.g. RLE for repeated characters, or replacing repeated words with shorter codes (dictionary coding).
- Bitmap: RLE stores runs of the same colour as a count and a colour; lossy methods reduce resolution or colour depth, or remove detail the eye won’t notice.
- Vector: simplify the drawing list, e.g. fewer objects or fewer points, and remove redundant properties.
- Sound: lossy perceptual coding removes sounds humans cannot hear or that are masked by louder sounds; or reduce sampling rate or resolution. Lossless formats such as FLAC keep all data.
RLE example: the pixel row WWWWWWBBBWW can be stored as 6W 3B 2W.
10. Examiner tips
- Kibi vs kilo: use 1024 for KiB, MiB…, and 1000 for kB, MB…. Read which one the question uses.
- Show your working in conversions and file-size calculations; method marks are available.
- Two’s complement subtraction: add the negative; ignore the final carry out of the 8th bit.
- Explain overflow in terms of the result needing more bits than are available.
- BCD is not binary: 46 in BCD is 0100 0110, not 0010 1110.
- Vector answers: use the words drawing list, drawing object and property.
- Justify the compression method for the situation, e.g. lossless for a text file because no data may be lost.
- Remember the file header when asked what a bitmap file contains.
11. Practice questions
Practice: answer and check instantly
Type a short answer, then press Check or Enter.
Show answer
1024 = 2¹⁰.
Show answer
1000 = 10³.
Show answer
0100 0111: 4 → 0100, 7 → 0111.
Show answer
1111 1011: 5 = 0000 0101, invert → 1111 1010, add 1.
Show answer
1111 1010: invert every bit of 0000 0101.
Show answer
1000 × 500 × 16 = 8 000 000 bits ÷ 8 = 1 000 000 bytes.
Show answer
A vector graphic.
Show answer
Lossless.
Exam-style questions
9. A company logo will be printed on business cards and on a large banner. Explain why it should be stored as a vector graphic. [3]
Show mark guide
Stored as drawing objects with properties in a drawing list [1] · can be scaled to any size without losing quality/pixelating [1] · small file size for a simple image made of shapes [1].
10. A 60-second stereo recording uses a sampling rate of 44 100 Hz and a sampling resolution of 16 bits. Calculate the file size in MiB. Show your working. [3]
Show mark guide
44 100 × 16 × 60 × 2 = 84 672 000 bits [1] · ÷ 8 = 10 584 000 bytes [1] · ÷ 1 048 576 ≈ 10.09 MiB [1].
12. Topic test: predict your grade
Topic test: predict your grade
15 questions, about 10 minutes. Answer them all, then press Mark my test.
Frequently asked questions
How do you convert a denary number to two’s complement?
Write the positive value in binary, then invert every bit and add 1. For example, -5 in 8 bits is 11111011.
What is the difference between a kibibyte and a kilobyte?
A kibibyte (KiB) is 1024 bytes, using powers of 2. A kilobyte (kB) is 1000 bytes, using powers of 10.
What is the difference between bitmap and vector graphics?
A bitmap stores the colour of every pixel, so it loses quality when enlarged. A vector graphic stores shapes as drawing objects and properties, so it scales without losing quality.