100% found this document useful (1 vote)
203 views70 pages

Binary Numbers and Hexadecimal Notes

in this you will learn how to convert denary number to binary and hexadecimal. You will also learn the uses of these numbers.

Uploaded by

Aaditya Sharma
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
203 views70 pages

Binary Numbers and Hexadecimal Notes

in this you will learn how to convert denary number to binary and hexadecimal. You will also learn the uses of these numbers.

Uploaded by

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

2019-2020

Chapter 1-Binary
systems and
hexadecimal
SECTION 1
THEORY OF COMPUTER SCIENCE

CH 1 - BINARY SYSTEMS AND HEXADECIMAL 1


1 Binary systems and hexadecimal
1.1 Binary number system
1.2 Measuring memory size
1.3 Example use of binary
1.4 Hexadecimal number system
1.5 Data storage
1.6 File Formats

CH 1 - BINARY SYSTEMS AND HEXADECIMAL 2


1.1 Binary Number System
a. Data
b. Analogue data
c. Digital data
d. Converting between denary and binary
e. Beyond 8-bit binary

CH 1 - BINARY SYSTEMS AND HEXADECIMAL 3


a. Data
Raw facts and figures in the form of number, symbols or
alphanumeric characters.

Information coded in a format ready for processing

CH 1 - BINARY SYSTEMS AND HEXADECIMAL 4


b. Analogue data
HUMANS COMPUTERS
Use analogue data such as sound Cannot process analogue data
or light wave
Can only process digital data
Can process and understand
analogue data Any data must first be converted
into digital
Everything they see and hear is a
continuous transmission of
analogue data

Data takes a wide set


of voltage values (v)
at different points of
time (t).

CH 1 - BINARY SYSTEMS AND HEXADECIMAL 5


c. Digital data
Data represented in the values 1 and 0
Data a computer can process

CH 1 - BINARY SYSTEMS AND HEXADECIMAL 6


d. Converting between denary and
binary
DENARY BINARY

Use in our daily live Computers use binary system


Digits 0-9 Digits 0-1
Base-10 number system Base-2 number system
Units increase by the power of 10 Units increase by the power of 2
Units begin at the right hand side Units begin at the right hand side
and increase by power of 10 as we and increase by the power of 2 as
move left we move left
1 indicates we use that unit
0 indicates we do not

CH 1 - BINARY SYSTEMS AND HEXADECIMAL 7


Example 1: Convert 150 denary to
a binary number
When we convert a denary number to 8-bit binary we use the
following units: 1 (20), 2 (21), 4 (22), 8 (23), 16 (24), 32 (25), 64 (26) and
128 (27)
Compare the denary number 150 to the first binary unit 128
If it is equal or larger than 128 then add 1 beneath it
Then deduct the 128 from 150 and we are left 22.

128 64 32 16 8 4 2 1
1

CH 1 - BINARY SYSTEMS AND HEXADECIMAL 8


Example 1: Convert 150 denary to
a binary number
Compare 22 to the next unit to the right (64)
If it is equal to or larger than 64 then add 1 beneath it
22 it is not larger than 64 so 0 can go beneath it

128 64 32 16 8 4 2 1
1 0

CH 1 - BINARY SYSTEMS AND HEXADECIMAL 9


Example 1: Convert 150 denary to
a binary number
Compare 22 to the next unit to the right (32)
If it is equal to or larger than 32 then add 1 beneath it
22 it is not larger than 32 so 0 can go beneath it

128 64 32 16 8 4 2 1
1 0 0

CH 1 - BINARY SYSTEMS AND HEXADECIMAL 10


Example 1: Convert 150 denary to
a binary number
Compare 22 to the next unit to the right (16)
If it is equal to or larger than 16 then add 1 beneath it
22 it is larger than 16 so 1 can go beneath it
Then deduct the 16 from 22 and we are left 6.
Continue this process until the end of the units and deduct the value
of any unit that you use.
128 64 32 16 8 4 2 1
1 0 0 1 0 1 1 0

So the denary number 150 is 10010110 as an 8-bit number


(150)10=(10010110)2

CH 1 - BINARY SYSTEMS AND HEXADECIMAL 11


Example 2: Convert the binary number
10010110 to a denary number
To convert the binary number to a denary , we need to add
together all of the binary units that are marked as required by the
digit 1.

128 64 32 16 8 4 2 1
1 0 0 1 0 1 0 0

This means that the denary conversion of this binary number is


128+ 16+ 4 = 148
(10010100)2=(148)10

CH 1 - BINARY SYSTEMS AND HEXADECIMAL 12


e. Beyond 8-bit binary
The same principle is used to convert beyond 8 bits by simply
using further binary units beyond 128
For example, the 12-bit binary number would be converted as
shown below:

2048 1024 512 256 128 64 32 16 8 4 2 1


1 0 1 1 0 0 1 0 1 1 0 1

2048+512+256+32+8+4+1=2861

CH 1 - BINARY SYSTEMS AND HEXADECIMAL 13


Activity A
Textbook Activity 1.1 page 3
Textbook Activity 1.2 page 3

CH 1 - BINARY SYSTEMS AND HEXADECIMAL 14


1.2 Measuring memory size
Most computer systems have storage which is measured in bytes
A byte is eight binary bits long
A byte can be used to represent a character for example, a letter, a
number, a symbol, a string of bits that that can be used to build an
image
Computer storage is usually measured in multiples of bytes
A Byte is abbreviated with the capital letter ‘B’
A bit is one eighth of a byte and is abbreviated with the lower-case
‘b’

CH 1 - BINARY SYSTEMS AND HEXADECIMAL 15


Nibble
A nibble is a group of 4 bits
It is also known as half-byte
A nibble has sixteen (24) possible values.
A nibble can be represented by a single hexadecimal digit

8 4 2 1

CH 1 - BINARY SYSTEMS AND HEXADECIMAL 16


Measurements for storage
Unit of measurement Abbreviation Conversion
Byte B 8 bits
Kilobyte KB 1024 byes
Megabyte MB 1024 KB
Gigabyte GB 1024 MB
Terabyte TB 1024 GB

CH 1 - BINARY SYSTEMS AND HEXADECIMAL 17


Measurements for storage
The conversion units commonly rounded down to reflect the
standard definition of the units of measurement
For example, kilo means one thousand and mega means one
million
Therefore they can be represented as shown in the table below.
Unit of measurement Abbreviation Conversion
Byte B 8 bits
Kilobyte KB 1000 byes
Megabyte MB 1000 KB
Gigabyte GB 1000 MB
Terabyte TB 1000 GB

CH 1 - BINARY SYSTEMS AND HEXADECIMAL 18


1.3 Example use of binary
Register: small piece of memory built into the central processing unit
(CPU) of a computer system where functions and instructions are
temporarily held
They are not part of primary memory or secondary storage
Extremely fast read and write rate
Data can be written to and read from a register much quicker than
from primary memory and secondary storage
Registers are used to hold values and instructions for processing
increasing the speed at which they can be processed

CH 1 - BINARY SYSTEMS AND HEXADECIMAL 19


1.3 Example use of binary
Processor Registers
PC (program counter),
Accumulator, MAR (memory
address register)
They can be written to and read
from extremely quickly
The fast speed of access makes
registers very suitable for
situations where small amounts of
data need to be accessed quickly
e.g. performing calculations

CH 1 - BINARY SYSTEMS AND HEXADECIMAL 20


1.3 Example use of binary
Hardware Registers
They are used to convey a signal
Consider a robot arm that has various motors to perform
different operations
For example, raise the arm, open the grip and close the grip. Each
motor works via a signal 1 for on and 0 for off
A register is used for each motor to convey the signal

CH 1 - BINARY SYSTEMS AND HEXADECIMAL 21


1.4 Hexadecimal number system
a. Hexadecimal number system
b. Converting between binary and hexadecimal
c. Converting between hexadecimal and binary
d. Converting between denary and hexadecimal
e. Converting between hexadecimal and denary
f. 5 uses of the hex system

CH 1 - BINARY SYSTEMS AND HEXADECIMAL 22


a. Hexadecimal number system
Hexadecimal- a system of numbers with a base of 16 each unit used
increases by the power of 16
Computers do not actually process hexadecimal they convert it into
binary before processing it
Programmers work with hexadecimal as it is easier for humans to
read than binary
Much shorter way of representing a byte of data
Programs written in hexadecimal are easier to debug (finding and
fixing errors in a program) than those written in binary
Computers need to convert hexadecimal data into binary before
processing it

CH 1 - BINARY SYSTEMS AND HEXADECIMAL 23


a. Hexadecimal number system
Hexadecimal uses 16 symbols:
◦ the numbers 0-9 and the letters A-F
The notation for each denary number is shown below:
Denary 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
Hex 0 1 2 3 4 5 6 7 8 9 A B C D E F

Only one symbol can be used per unit in Hex


Each unit is represented by one digit

CH 1 - BINARY SYSTEMS AND HEXADECIMAL 24


b. Converting between binary and
hexadecimal
Split binary number into groups of 4 bits from right to left
If the last group has less than 4 bits then fill in with 0s from the left
Convert each group of bits into the equivalent hexadecimal digit (see
Table .2 page 6)
Example 1:

1 0 1 0 1 1 0 0

First spilt into groups of 4 bits


1 0 1 0 1 1 0 0

Find the equivalent


A (10) C (12) hexadecimal digits

(10101100)2=(AC)16

CH 1 - BINARY SYSTEMS AND HEXADECIMAL 25


b. Converting between binary and
hexadecimal
Example 2:
1 1 1 1 0 0 0
First spilt into groups of 4 bits
0 1 1 1 1 0 0 0
Add in one 0 to the left group

0 1 1 1 1 0 0 0

Find the equivalent


8 hexadecimal digits
7

(01111000)2=(78)16

CH 1 - BINARY SYSTEMS AND HEXADECIMAL 26


c. Converting between
hexadecimal and binary
Simply take each hexadecimal digit and write down the 4-bit code which
corresponds to the digit
Example 1:
Find the 4-bit code for
E 9
each digit

1110 1001
Put the groups together
(E9)16= (11101001)2 to form the binary
number

CH 1 - BINARY SYSTEMS AND HEXADECIMAL 27


d. Converting between denary
and hexadecimal – Method 1
Convert the following decimal numbers to hex number:
Example 1: 12510
125/161 =7 125-16*7=13 (remainder)
13/160= 13(D) 13-160*13=0 (remainder)
Thus 12510= 7D16

Example 2: 90010
900/162 =900/256=3 900-162*3=900-768=132 (remainder)
132/161= 8 132-16*8=4 (remainder)
4/160=4 4-160*4=0 (remainder)
Thus 90010= 384 16

CH 1 - BINARY SYSTEMS AND HEXADECIMAL 28


d. Converting between denary
and hexadecimal – Method 2
Convert the following decimal number to hex
8110
Covert the decimal number into binary equivalent.
Divide the binary number into groups of 4 bits (right to left)
Covert each group into hex equivalent.

8 1
128 64 32 16 8 4 2 1
0 1 0 1 0 0 0 1
8 4 2 1 8 4 2 1
5 1

So the decimal number 8110 =5116


CH 1 - BINARY SYSTEMS AND HEXADECIMAL 29
e. Converting between hexadecimal
and denary – Method 1
Convert the following hex numbers to decimal:
Example 1:
58916= 5 x 16² + 8 x 16¹ + 9 x 16°
= 1280 + 128 + 9 = 1417 10

Example 2:
FA8 16 = F(15) x 16² + A(10) x 16¹ + 8 x 16°
= 3840+ 160+ 8= 400810

CH 1 - BINARY SYSTEMS AND HEXADECIMAL 30


e. Converting between hexadecimal
and denary – Method 2
Convert the following hex number to decimal
A816
Covert each hexadecimal digit into binary equivalent.

A 8
8 4 2 1 8 4 2 1
1 0 1 0 1 0 0 0
128 64 32 16 8 4 2 1

So the hexadecimal number A8 equals 128+32+8=16810

CH 1 - BINARY SYSTEMS AND HEXADECIMAL 31


Activity B
Textbook Activity 1.4 page 7
Textbook Activity 1.5 page 7
Textbook Activity 1.6 page 8
Textbook Activity 1.7 page 9

CH 1 - BINARY SYSTEMS AND HEXADECIMAL 32


f. Use 1 – HTML colour notation
Hexadecimal is used as a notation for
colour in HTML
Hex colour notations are normally six
digits and each hex notation represents
a different colour
For example, #FFFF00 is yellow and
#000000 is black
The first 2 digits represent the RED
component, the second two the GREEN
and the last two the BLUE

CH 1 - BINARY SYSTEMS AND HEXADECIMAL 33


Activity C
Textbook Activity 1.8 page 11

CH 1 - BINARY SYSTEMS AND HEXADECIMAL 34


d. Use 2 – Display error codes
Standard Windows error messages are given in hexadecimal
notation
For example, error code #404 ‘File not found’ is a hexadecimal
notation

CH 1 - BINARY SYSTEMS AND HEXADECIMAL 35


d. Use 3 – Display MAC Addresses
MAC (Media Access Address) are 12-digit hexadecimal numbers
that uniquely identify each device in a network
For example, 00-1B-63-84-45-E6 (12 hex digits=48 bits=6 bytes)

Find MAC Address of NIC


In the Run box, type cmd
This will open the command
promt window.
At the command prompt, type
ipconfig /all.

CH 1 - BINARY SYSTEMS AND HEXADECIMAL 36


d. MAC Address
A MAC address is usually made up of 48 bits (6 groups of hexadecimal
digits
NN-NN-NN-DD-DD-DD or
NN:NN:NN:DD:DD:DD
The first half is the identity number of the manufacturer of the device
and the second half is the serial number of the device
For example 00-1C-B3-4F-25-FE is the MAC address of a device
produced by Apple Corporation (code: 001CB3) with serial number
4F25FE
Sometimes lowercase hexadecimal letters are used

CH 1 - BINARY SYSTEMS AND HEXADECIMAL 37


d. Types of MAC Address
Universally Administered MAC Address (UAA)
◦ Most common type
◦ Set by the manufacturer at the factory

Locally Administered MAC Address (LAA)


◦ Type of MAC that allows a user/organisation to change their MAC
address
◦ Causes problems if the changed address is not unique

Reasons for changing the MAC address using LAA


◦ Certain software needs all the MAC addresses to fall into a strict format
◦ Bypass a MAC address filter on a router or firewall
◦ To get past certain types of networks restrictions

CH 1 - BINARY SYSTEMS AND HEXADECIMAL 38


d. Example 3 – MAC Address
MAC address

Network card showing its MAC address

CH 1 - BINARY SYSTEMS AND HEXADECIMAL 39


d. Use 4 – Display machine
code/programs/Memory dumps
Machine code consists of simple instructions that are directly
executed by the CPU
Hex is used for machine code as each byte can be coded as two
hexadecimal symbols
Using hexadecimal makes it mush easier, faster and less error
prone to write code compared to binary.
E.g 5F 3A 09 F1

CH 1 - BINARY SYSTEMS AND HEXADECIMAL 40


Memory dumps
A memory dump is a process in which the contents of memory are
displayed and stored in case of an application or system crash.
Memory dump helps software developers and system administrators to
diagnose, identify and resolve the problem that led to application or
system failure.
Hexadecimal is often used
A program developer can look at each of the hex codes and determine
where the error lies
Much more manageable using hex rather than binary

Memory
location

CH 1 - BINARY SYSTEMS AND HEXADECIMAL 41


e. Use 5 – Display ASCII/Unicode
values
For example, %41 for A
See slides 45-48

CH 1 - BINARY SYSTEMS AND HEXADECIMAL 42


1.5 Data storage
a. Text, numbers and symbols
b. Pictures
c. Sound
d. Data compression
e. Lossy Compression
f. Lossless compression
g. Example 1 – Lossless compression
h. Example 2 – Images
i. Example 3 – Lossy compression

CH 1 - BINARY SYSTEMS AND HEXADECIMAL 43


Data storage
All data stored on a computer is in binary form
Time consuming if we had to carry our daily tasks on a computer
using only binary
For example, writing an email to your friend using only binary
A number of systems and software were developed to do this for
users and help computers to store different data such as text,
images, video and audio

CH 1 - BINARY SYSTEMS AND HEXADECIMAL 44


a. Text, numbers and symbols
Character: text, numbers and symbols for example each key on a
keyboard
Character Sets: ASCII and UNICODE
Capital letters and small case letter have individual binary codes
as do numbers and punctuation

CH 1 - BINARY SYSTEMS AND HEXADECIMAL 45


ASCII character set

CH 1 - BINARY SYSTEMS AND HEXADECIMAL 46


a. Text, numbers and symbols
ASCII UNICODE
uses only 8 bits uses 16 bits
each character takes up 1 byte each character takes up 2 bytes
storage space as it is made up of 16 bits
giving 256 possible characters giving 65536 possible characters
suitable for Standard English contains many more characters
than ASCII
does not contain a large enough
character set for other languages

CH 1 - BINARY SYSTEMS AND HEXADECIMAL 47


Activity D
Textbook Activity 1.9 page 13

CH 1 - BINARY SYSTEMS AND HEXADECIMAL 48


b. Pictures
An image as we see it is an analogue data.
It must be converted to digital data for a computer to process it
using a scanner or a digital camera
Images are made up of pixels (tiny dots on the computer)

If an image is simply black and white each


pixel would either be black or white. (1
representing black pixels and 0
representing white pixels)

CH 1 - BINARY SYSTEMS AND HEXADECIMAL 49


b. Pictures
If we are given a series of binary data we can use this in a grid
We need to know the dimensions of the grid to be able to create the
image
This data is called Metadata
Metadata it tells the computer how many pixels wide and how many
pixels high an image should be (Image resolution)
The grid shown below is 10X10

CH 1 - BINARY SYSTEMS AND HEXADECIMAL 50


b. Pictures
If an image has more than 2 colours a computer needs further
binary data to represent the colour of the pixel
Most colours are made up of red, green and blue in the RGB
colour system
Images can become large files especially when they are high in
quality
Colour depth: the number of bits used for each colour
component of a single pixel

CH 1 - BINARY SYSTEMS AND HEXADECIMAL 51


Convert a captured image to a
digital file
Image is converted from analogue to digital
Image is turned into pixels
Each pixel is given a binary value
Each pixel has a colour
Pixels are stored in sequence (in a file)
Meta data is stored to describe the dimensions, resolution of the image.
(It stores the dimensions/colour/depth etc…)
An example of a suitable photo file format e.g. JPEG

CH 1 - BINARY SYSTEMS AND HEXADECIMAL 52


Colour depth examples
1-bit colour (monochrome): one bit is allocated to each pixel, restricting the
colour of each pixel to black (0) or white (1).
12-bit colour (direct colour): 4 bits are allocated for each red, green and blue
components
◦ enabling 4,096 different colours (212= 24X24X24=16x16x16)
◦ this is sometimes used in devices with a limited colour display such as
mobile telephones.
24-bit colour (true colour): uses 8 bits to represent red, 8 bits to represent
green and 8 bits to represent blue
◦ a total of 16,777,216 colours (224=28X28X28=256X256X256)

CH 1 - BINARY SYSTEMS AND HEXADECIMAL 53


Calculate image file size
An image is to be stored electronically. The image is 256 pixels high by 200
pixels wide with a 16-bit colour depth.
How much disk space would the image occupy in kilobytes?

File size = Image Resolution X Colour Depth

Image resolution= 256 X 200


Colour depth= 16
File size (bits) = 256 x 200 x 16 = 819 200
File size (bytes) = 819 200 / 8 = 102 400
File size (kilobytes) = 102 400/ 1024 = 100 KB

CH 1 - BINARY SYSTEMS AND HEXADECIMAL 54


c. Sound
The sound we hear is also analogue
It must be converted to binary for a computer to be able to process
it
Sound is recorded using a microphone and converted to binary by
software
Sound is recorded at set time intervals (sampling)
The samples are then converted into binary
If the set time intervals are close together the sound track will be
higher in quality (more samples more accurately captured)
Samples sizes are measured in hertz (1 hertz = 1 sample per second)
A telephone communication samples a voice at 8000Hz but a higher
quality recording such as a CD samples music at 44100 Hz.
CH 1 - BINARY SYSTEMS AND HEXADECIMAL 55
c. Sound
Take the simple sound wave in Figure 1

Figure 1

Time sample 1 2 3 4 5 6 7 8 9 10 11 12
Table 1
Sound value 9 13 9 3.5 4 9 1.5 9 8 5 8 5.5

If we record the sound value at each time sample we would have the values
in Table 1

CH 1 - BINARY SYSTEMS AND HEXADECIMAL 56


c. Sound
If we then play back the recording
the system will use the value at
each sample interval to do this.
The resultant wave is shown in
Figure 2.
This is what affects the quality of Figure 2: Sound wave created by playing back a
recorded sound recorded sound

The closer together the time


samples that are taken, the higher
the quality of the recorded sound
When the sound is played back it
has more data to help create a
more accurate sound

Figure 3: Quality of recorded sound

CH 1 - BINARY SYSTEMS AND HEXADECIMAL 57


Calculate sound file size
A 30-second sound clip has to be recorded. The sound will be sampled
16000 times a second. Each sample will be stored using 8 bits.
How much disk space would the captured sound clip occupy in
kilobytes?
File size = Sample Rate X Depth X Length of sound

Length of song = 30 seconds


File size (bits) = 16000 x 8 x 30 = 3 840 000
File size (bytes) = 3 840 000/ 8 = 480 000
File size (kilobytes) = 480 000 / 1024 = 468 KB

CH 1 - BINARY SYSTEMS AND HEXADECIMAL 58


d. Data compression
The bit structure of a file is manipulated in such way that the data in
a file will become smaller in size.
Less storage space will be needed to store the file
The file will be easier to transmit from one device to another
Data compression uses compression algorithms (step by step set of
instructions) which manipulate data so that repeating data is
removed either on a temporary or permanent basis.

CH 1 - BINARY SYSTEMS AND HEXADECIMAL 59


e. Lossy compression
Lossy is derived from the word ‘loss‘
Data that is deemed redundant or unnecessary is removed in the
compression process
The data is removed permanently so it is effectively ‘lost’
The size of the file is reduced
Mostly used for multimedia such as audio, video and image files
Mostly done when streaming these files as a file can be streamed much
more effectively if it is smaller in size
For example, on a music file it will try to remove all the background
noise and noises that may not be heard by the human ear
◦ This data is not hugely necessary for playing the track
◦ The track will not sound exactly as it did when recorded

CH 1 - BINARY SYSTEMS AND HEXADECIMAL 60


f. Lossless compression
Lossless loses no data in the process
Compressed data can be reversed to reconstruct the data file exactly as
it was
It is used when it is essential that no data is lost or discard during the
compression process
Many different algorithms most work using a shorthand to store the
data that can be reconstruct when the file is opened.
How it works: look for repeating patterns in the file. Store this pattern
along with how many times is repeated
Examples:
◦ Download a music track for which you need the highest quality and
hear the track exactly as it a recorded
◦ When storing text file

CH 1 - BINARY SYSTEMS AND HEXADECIMAL 61


g. Example 1- Lossless
compression
Consider the following message:
WHEN IT IS SNOWING HEAVILY LOOK OUTSIDE
LOOK OUTSIDE IT IS SNOWING HEAVILY
Spaces and full stops are excluded
The message has a total of 63 characters
1 character requires 1 byte of storage thus we would need 62 bytes
of memory to store this message
Instead of storing 62 characters individually we could store the words
and positions at which they occur in the message

CH 1 - BINARY SYSTEMS AND HEXADECIMAL 62


g. Example 1 - Lossless Word Position/s in
compression the message
WHEN 1
Therefore we would need 33 bytes+
IT 2
13 bytes = 46 bytes 10
This is much less than 62 bytes IS 3
11
No data has been lost and we have
reduced our storage requirements by SNOWING 4
26% 12
HEAVILY 5
To recreate the message the words
13
must be retrieved and placed in the
positions allocated LOOK 6
8
The amount of compression can be
OUTSIDE 7
achieved varies depending on the data
9
we wish to store
33 BYTES 13 BYTES

CH 1 - BINARY SYSTEMS AND HEXADECIMAL 63


h. Example 2 - Images
Image files can be huge
This can make downloading and uploading or emailing very difficult
and time consuming
Many emails limit the size of the file can be attached
Both lossy and lossless methods of compression reduce the size of
an image by looking for repeating colour patterns within the image
For example, an image that has a main background colour the same
throughout the image, a compression method will recognise that
there are a lot of pixels with the same value and collate them.
◦ They will be stored as a single data value with further data that
records the pattern.

CH 1 - BINARY SYSTEMS AND HEXADECIMAL 64


i. Example 3 – Lossy compression
Lossy compression will reduce the file size further
Removing detail from the image that should go unnoticed and will
not affect the quality too much
It removed a little bit detail each time the image is saved in the
compression method
There will be a small loss in quality each time it is saved

CH 1 - BINARY SYSTEMS AND HEXADECIMAL 65


1.6 File formats
File format: 3 or 4 characters separated from the file name with a dot “.”
and is known as file extension. It is a method to store different data on a
computer dot
File name File extension
image . jpg
Different file formats encode data (organise data for storage) in
different ways
It is important for software to recognise the file format used to save the
data to access it
There are specific to software file formats or more generic /standard
The file format of a file depends on the type of data it stores

CH 1 - BINARY SYSTEMS AND HEXADECIMAL 66


File Type File extension Use
Text .doc MS Word document
.rtf Rich text format
1.6 File
.pdf Portable document format
formats
Data .csv Comma separated values file
Common file
.xls MS Excel Spreadsheet
extensions
.mdb MS Access database
Audio .mp3 MP3 audio file
.mid MIDI file
.wav Wave audio file
Video .mp4 MPEG-4 video file
.flv Flash video file
.wmv Windows Media video file
Image .bmp Bitmap file
.gif Graphic interchange format graphic
.jpg JPEG photo
.png Portable network graphic
CH 1 - BINARY SYSTEMS AND HEXADECIMAL 67
1.6 Standard File formats – MIDI
MIDI (Musical Instrument Digital Interface): uses a series of protocols
and interfaces that allow lots of different types of musical instrument to
connect and communicate
MIDI allows one computer/instrument to control other instruments
The controlling device instructs the others on which notes to play and
when, specifying the pitch, duration and velocity of each tone
MIDI files are not a musical recording but a series of instructions for an
instrument to carry out
MIDI program may come with a graphical user interface that looks like a
sound studio control room

CH 1 - BINARY SYSTEMS AND HEXADECIMAL 68


1.6 Standard File formats
– JPEG/ MP3/MP4
JPEG
◦ Joint Photographic Experts Groups is a standard format for lossy
compression of images
◦ It can reduce files down to 50% of their original size
MP3
◦ A standard format for lossy compression of audio files
MP4
◦ A standard format for lossy compression of video files
◦ It can also be used on other data such as audio and images

CH 1 - BINARY SYSTEMS AND HEXADECIMAL 69


Related Resources
Chapter1.html
Binary counter – for example: www.mathsisfun.com/binary-decimal-
hexadecimal-converter.html
Cisco binary game:
http://forums.cisco.com/CertCom/game/binary_game_page.htm
Hexadecimal counter – for example: www.mathsisfun.com/binary-
decimal-hexadecimal-converter.html

CH 1 - BINARY SYSTEMS AND HEXADECIMAL 70

You might also like