0% found this document useful (0 votes)
17 views6 pages

Data Representation What You Need to Know

The document covers essential concepts of number representation in computing, including conversions between binary, denary, and hexadecimal systems, as well as two's complement for negative numbers. It explains how data types like text, sound, and images are processed and stored in binary, and discusses data storage, compression techniques, and their advantages and disadvantages. Additionally, it provides examples of past exam questions related to these topics.

Uploaded by

andreadevi123
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views6 pages

Data Representation What You Need to Know

The document covers essential concepts of number representation in computing, including conversions between binary, denary, and hexadecimal systems, as well as two's complement for negative numbers. It explains how data types like text, sound, and images are processed and stored in binary, and discusses data storage, compression techniques, and their advantages and disadvantages. Additionally, it provides examples of past exam questions related to these topics.

Uploaded by

andreadevi123
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

What you need to know Topic 1

Number representation
Any form of data needs to be converted to binary to be processed by a computer.
Data is processed using logic gates and stored in registers.

Convert between
A positive denary and positive binary
Example: Convert 01001000 to denary and 147 to binary
1) 01001000 = 128 64 32 16 8 4 2 1 2) 147 = 128 64 32 16 8 4 2 1
= 0 1 0 01000 = 1 0 0 10011
= 64 + 8 = 10010011
= 72
B, positive denary and positive hexadecimal
Example: Convert 1023 to hexadecimal and F56 to denary
1) 1023 = 256 16 1 2) F56 = 256 16 1
3 F F 5 6 (Note: F= 15)
= 3FF = 3840 + 80 + 6
= 3926
C, positive hexadecimal, and positive binary
Example: Convert EC4 to binary and 0110 0111 1100 1111 to hexadecimal
1) EC4= E C 4 2) 0110 0111 1100 1111= 0110 0111 1100 1111
1110 1100 0100 6 7 9 F
= 1110 1100 0100 =679F

Hexadecimal is used as a beneficial method of data representation as hexadecimal is


easier for humans to understand than binary, as it is a shorter representation of the
binary.
Areas within computer science in which hexadecimal is used are:
1) Error codes
2) Media Access Control (MAC) addresses
3) Internet Protocol (IP) addresses
4) Hypertext Mark-up Language (HTML) colour codes

(a) Add two positive 8-bit binary integers


Example: Add 10101010 and 00101101
10101010
+00101101
1 1 (Carry Values)
11010111 (Sum Values)

An overflow error will occur if the value is greater than 255 in an 8-bit register.
A computer or a device has a predefined limit that it can represent or store. An overflow
error occurs when a value outside this limit is reached.

Logical binary shift


The positive binary integer is multiplied by two if the number is shifted to the left or
divided by two when it is shifted to the right.
Bits shifted from the end of the register are lost and zeros are shifted in at the opposite
end of the register.
The most significant bit(s) or least significant bit(s) are lost.
For example: Shift 01101110 to the right and left.

1
To the left: 128 64 32 16 8 4 2 1 To the right: 128 64 32 16 8 4 2 1
1 1 0 11100 0 0 1 10111

Two’s complement
Twos complement is used to represent negative numbers. In twos complement system
the left most digit is always a negative number the left most digit determines the sign of a
number
Convert a positive binary or denary integer to a two’s complement 8-bit integer and vice
versa.
For example: Convert 57 and 01101011 to two´s complement.
1) 57= Step 1: it is a positive number write the 2) 01101010= It is already in two´s
Left-most value as zero complement and if the
Step 2: Write as normal binary number most significant digit is 1.
128 64 32 16 8 4 2 1 add a 0 at the left.
0 0 1 11001

Convert a two’s complement 8-bit integer to denary and vice versa.


For example: Convert -57 to twos complement and 10100101 to denary.
1) -57= Step 1: Write as a normal binary number 2) 10100101= -128 64 32 16 8 4 2 1
00111001 1 0 1 00101
Step 2: Inverse the letters = -128 + 32 + 4 + 1
11000110 = -91
Step 3: Add 1
11000110
+ 1
11000111

Text
A computer represents text by using of character sets, including American standard
code for information interchange (ASCII) and Unicode.

Text is converted to binary to be processed by a computer.

ASCII uses 7-bit codes with the first 32 (used for control codes. Extended ASCII uses 8-
bit binary codes allowing for 128 more characters, the character sets are different for
windows and DOS.
Unicode uses 16-to-32-bit binary codes. Unicode allows for a greater range of
characters and symbols than ASCII, including different languages and emojis with the
first 128 characters are the same as ASCII.
Unicode requires more bits per character than ASCII.

Sound
Sound waves are analogue data, and the computer cannot understand analogue data,
so the sound waves are sampled (measuring the amplitude) for sound to be converted to
binary by the Analogue to Digital Converter (ADC) which is then processed by the
computer.

The sample rate is the number of samples taken in a second.


The sample resolution (also known as bit rate) is the number of bits per sample.
The accuracy of the recording and the file size increases as the sample rate and
resolution increase.
How sampling is used to record a sound clip:
1) The amplitude of the sound wave is determined at specific intervals (sampling rate)
2) This gives an approximate representation of a sound wave
3) Each sample of the sound waves is encoded as a series of binary digits

The advantages and disadvantages of using a larger sampling resolution when


recording sound.

Advantages Disadvantages
Larger dynamic range Larger file size
Better sound quality Longer to transmit/download sound files
Less sound distortion Requires greater processing power

Images
A bitmap image is a series of pixels that are converted to binary, which is processed by
a computer.
The resolution is the number of pixels in the image, the higher the resolution the higher
the image quality.
The colour depth is the number of bits used to represent each colour a black and white
image only uses 2-bit colour depth, modern computer uses 24-bit colour depth.
The file size and quality of the image increases as the resolution and colour depth
increase.

Data storage and compression


A bit is the basic unit of all computer memory storage term and is either a 0 or 1, 8 bits
make up a byte.
There are two ways of measuring 1) The standard system (just for understanding not
real name) and 2) The IEC system.
The standard system is based on the SI system. The IEC system is more accurate as
data is stored in the powers of 2.

1) The standard system

Name of memory size Equivalent denary value


One kilobyte (KB) 1000 bytes
1 megabyte (MB) 1000 kilobytes
1 gigabyte (GB) 1000 megabytes
1 terabyte (TB) 1000 gigabytes
1 petabyte (PB) 1000 terabytes
1 exabyte (EB) 1000 petabytes

2) The IEC (International Electrotechnical Commission) system

Name of memory size Number of bytes Equivalent denary value


1 kibibyte (KiB) 2^10 1024 bytes
1 mebibyte (MiB) 2^20 1024 kibibytes
1 gibibyte (GiB) 2^30 1024 mebibyte
1 tebibyte (TiB) 2^40 1024 gibibyte

3
1 pebibyte (PiB) 2^50 1024 tebibyte
1 exbibyte (EiB) 2^60 1024 pebibyte

Calculate the file size of an image file and a sound file, using information given:

1) The file size of an image = image resolution (in pixels) x colour depth (in bits)

2) The file size of a mono sound file


= sample rate (in Hz) x sample resolution (in bits) x length of sample (in seconds)
For a stereo sound file, multiply the result by two.

Understand the purpose of and need for data compression.

Compression exists to reduce the size of the file.


The impact of this is: less bandwidth required - less storage space required - shorter
transfer, upload and download times – less time required to stream music or videos.

In lossy file compression the algorithm eliminates unnecessary data from the file and the
file cannot be reconstructed. The algorithm decides which parts to retain and which parts
to discard.
1) In an image it may reduce the resolution and colour depth
2) In a sound file it may reduce the resolution and sample frequency

Some common lossy file compression algorithms are:

a) MPEG 3 (MP3) & MPEG 4 (MP4)

MP3 files are used for playing music. They reduce about 90% while retaining most of the
music quality. The data eliminated by the algorithm are:

1) Removal of sounds outside the human ear range


2) If two sounds are played at the same time the softer sound is eliminated

MP4 files are like MP3 files but are used for storing multimedia files like music, videos,
photographs, and animations.

b) JPEG

JPEG is a lossy file compression algorithm used for bitmap images. The algorithm is
based on two concepts:

1) Human eyes do not differentiate as well between colour shades as compared to


brightness
2) By separating colour from brightness, images are split into 8x8 pixel blocks which
allows for certain information to be discarded

Lossless compression reduces the file size without permanent loss of data.

Run-length encoding (RLE) is used for lossless compression of a number of different file
formats:

1) It reduces the size of a string of adjacent, identical data (repeated data)


2) A repeating string is encoded into two values-
i) the first value represents the number of identical data items (e.g.: characters) in a
run
ii) the second value represents the code of the data item (such as ASCII code if it is a
keyboard character)
3) RLE is only effective if there are a lot of repeated bits

An issue with a string such as `cdcdcdcdcd´ where RLE compression is not highly
effective, in such a situation a flag is used. A flag preceding data indicates that what
follows are the number of repeating units, when a flag is not used, the next byte(s) are
taken at face value.

Using RLE on text data

We put first the number of times a text is repeated and then the ASCII code of the text.

String aaaaaaaa bbbbbbbbbb c d c d c d eeeeeeee


Code 08 97 10 98 01 99 01 100 01 99 01 100 01 99 01 100 08 101

The original string contains thirty-two characters and would occupy thirty-two bytes of
storage.

The coded version contains eighteen characters and would require eighteen bytes of
storage.

Introducing a flag (255) in this case produces:

255 08 97 255 10 98 99 100 99 100 99 100 255 08 101

This has fifteen values and requires fifteen bytes of storage. This compression saves 53%
compared to the original string.

Using RLE with images

Example 1: Black & White images

The figure `F´ is in a grid with each square requiring one byte of storage. A white square with
value 1 and black square with value 0.

The 8x8 grid would require sixty-four bytes; the compressed RLE format has thirty values,
and therefore needs only thirty bytes to store the image.

Example 2: Coloured images

5
The figure shows an image with four colours each colour is made up of red, green, and blue
(RGB) according to the code to the right.

This produces the following data: 2 0 0 0 4 0 255 0 3 0 0 0 6 255 255 255 1 0 0 0 2 0 255 0 4 255 0 0 4
0 255 0 1 255 255 255 2 255 0 0 1 255 255 255 4 0 255 0 4 255 0 0 4 0 255 0 4 255 255 255 2 0 255 0.
1 0 0 0 2 255 255 255 2 255 0 0 2 255 255 255 3 0 0 0 4 0 255 0 2 0 0 0

The original image (8x8 square) would need 3 bytes per square (to include all three RGB values), so
the uncompressed file for this image is 8x8x3= 192 bytes.
The RLE code has ninety-two values, so the compressed file is ninety-two bytes in size. Therefore,
the compressed file is 52% smaller.

Past exam questions for the topic above:

March 2019 Paper 12, question 1, 3, 4(c)


June 2019 Paper 12, question 4b
June 2019 Paper 13, question 1a
Nov 2019 Paper 11, question 2 and 6d
Nov 2019 Paper 12, question 1, 4, 5 a b
Nov 2019 Paper 13, question 1(c)
March 2020 Paper 12, question 3d and 5
June 2020 Paper 11, question 3(c) and 9(d)
June 2020 Paper 12, question 7
June 2020 Paper 13, question 1
2023 Specimen Paper 1, q1

You might also like