Skip to content
Marlbridge

Flashcards · 0478 · Topic 1

Data representation flashcards

20 cards on Topic 1, subtopics 1.1 to 1.3. Pick a subtopic or study them all.

Study mode needs JavaScript. Every card is listed below, so you can still cover the answers and test yourself.

All 20 cards

For a quick read-through or printing. Cover the right-hand side to test yourself.

1.1 Number systems

Why do computers store data in binary?
A computer is built from switches (transistors) that have two states, on and off, which are represented as 1 and 0. All data and instructions are therefore stored and processed as binary.
How do you convert binary to hexadecimal?
Split the binary number into nibbles (groups of 4 bits) from the right, then convert each nibble to one hex digit (0-9, then A=10 to F=15). Example: 11011001 → 1101 1001 → D9.
Why is hexadecimal used in computer science?
It is a shorter, more readable way for humans to write binary, with fewer errors. Uses include MAC addresses, IPv6 addresses, colour codes, memory dumps and error codes. The computer itself still stores binary.
What is overflow in binary addition?
The result of a calculation needs more bits than the register can hold, so the extra (most significant) bit is lost and the stored answer is wrong. In 8 bits, any result over 255 overflows.
What does a logical shift do to an unsigned binary number?
A shift left of one place multiplies the number by 2; a shift right of one place divides it by 2. Bits shifted out of the register are lost, which can make the result inaccurate.
How do you write a negative number in 8-bit two's complement?
Write the positive number in binary, flip every bit, then add 1. Example: 19 = 00010011 → 11101100 → 11101101, which is -19. The leftmost bit has a place value of -128.
Convert denary 174 to binary and hexadecimal
174 = 128 + 32 + 8 + 4 + 2 = 10101110. Nibbles 1010 and 1110 are A and E, so the hex value is AE.

1.2 Text, sound and images

What is a character set?
A defined list of characters that a computer recognises, each with a unique binary code. ASCII and Unicode are examples.
ASCII vs extended ASCII vs Unicode: bits and number of characters
ASCII: 7 bits, 128 characters. Extended ASCII: 8 bits, 256 characters. Unicode: 16 bits or more per character, covering a very wide range of the world's writing systems.
Why is Unicode used instead of ASCII for a multilingual website?
ASCII cannot represent non-Latin scripts. Unicode covers a very wide range of languages and symbols, though it can need more storage per character.
What are sample rate and sample resolution in sound?
Sample rate: the number of samples of the sound wave taken per second (Hz). Sample resolution: the number of bits used to store each sample. Raising either improves accuracy and increases file size.
What are image resolution and colour depth?
Resolution: the number of pixels in the image (width × height). Colour depth: the number of bits used per pixel; n bits give 2ⁿ possible colours. Raising either improves quality and increases file size.
How many colours can be shown with a colour depth of 8 bits?
2⁸ = 256 colours.

1.3 Data storage and compression

What are a nibble and a byte?
A nibble is 4 bits. A byte is 8 bits (two nibbles).
List the storage units from KiB upwards and the factor between them
Kibibyte (KiB), mebibyte (MiB), gibibyte (GiB), tebibyte (TiB), pebibyte (PiB), exbibyte (EiB). Each is 1024 times the one before; 1 KiB = 1024 bytes.
How do you calculate the file size of an image and of a sound file?
Image (bits) = width × height × colour depth. Sound (bits) = sample rate × sample resolution × length in seconds. Then ÷ 8 for bytes, ÷ 1024 for KiB, ÷ 1024 again for MiB.
Lossless vs lossy compression
Lossless: removes redundancy so the original file can be restored exactly (e.g. RLE); used for text and program files. Lossy: permanently removes detail people are unlikely to notice, giving much smaller files; used for photos, music and video.
How does run length encoding (RLE) work?
It replaces a run of identical values with one value-and-count pair, e.g. WWWWBBB → 4W 3B. It is lossless and works best on images with large blocks of one colour, not on photographs.
Why is compression used?
Smaller files use less storage space, upload and download faster, and use less bandwidth when sent over a network.
An image is 1024 × 768 pixels with 24-bit colour. What is its size in MiB?
1024 × 768 × 24 = 18,874,368 bits ÷ 8 = 2,359,296 bytes ÷ 1024 = 2304 KiB ÷ 1024 = 2.25 MiB.