SlideShare a Scribd company logo
Data
representation
1.1 Binary and hexadecimal system.
What Is a Number System?
Number system is a way to represent numbers.
We are used to using the base-10 (0-9) number system, which is also called decimal/denary .
Other common number systems include base-16 (hexadecimal 0-F), and base-2 (binary 0-1).
What is the importance of binary system in computers?
• Computers use binary because they can only read and store an on or off charge. Zero (0) is
equivalent to off and one (1) is equivalent to on.
• Computers use binary – the digits 0 and 1 – to store data.
The circuits in a computer’s processor are made up of billions of transistors .
• A transistor is a tiny switch that is activated by the electronic signals it receives. The digits 1 and 0 used
in binary reflect the on and off states of a transistor.
• Binary numbers can be considered the very basic representation of a number in an electronic device.
Types of data:
Analogue data / continuous : Analog data is data that is represented in a physical
way, that is processed by humans , everything we can see, hear,smell is continous
stream to our senses .
Sound, videos and images are in analogue form.
Digital Data / discrete : Data that are electromagnetically stored in the form of discrete digits
with two values using binary digits 0,1 .
Computers understand only digital data (binary) , so any data must be converted to
binary (digital) to be save and processed by the computers .
Number systems
Denary /decimal system :
• Base 10 using numbers 0-9 .
• Most of the numbers used internationally are denary numbers .
• Place value of denary goes up in factors of ten : ones , tens , hundreds ,
thousands …………..
ten thousands thousands hundreds Tens ones
* 10 4
* 10 3
* 10 2
* 10 1
* 10 0
Example : the number 1478.
1 * 10 3
+ 4 * 10 2
+ 7 * 10 1
+ 8* 10 0
=
1000 + 400 + 70 + 8 = 1478
Binary system
Denary /decimal system :
• Base 2 using numbers 0-1 .
• Used to represent data used by the processors .
• The units for the binary number bit , nibble , byte , ……….
• Place value of Binary goes up in factors of 2 .
Place value
128 64 32 16 8 4 2 1
* 27
* 26
* 25
* 24
* 23
* 2 2
* 2 1
* 2 0
Example 1 0 1 0 1 1 0 1
Example : the number 10101101. convert to denary
1 * 2 7
+ 0 * 2 6
+ 1 * 2 5
+ 0 * 2 4
+ 1 * 2 3
+ 1 * 2 2
+ 0 * 2 1
+ 1* 20
=
1*128 + 0*64 + 1 * 32 + 0 * 16 + 1 * 8 + 1 *4 + 0 * 2 + 1*1 =
128 + 0 + 32 + 0 + 8 + 4 + 0 + 1 = 173
128 + 32 + 8 + 4 + 1 = 173
Converting from binary to denary (method1):
It is fairly straightforward to change a binary number into a denary number.
Convert the following binary numbers into
denary: a 0 0 1 1 0 0 1 1
b 0 1 1 1 1 1 1 1
c 1 0 0 1 1 0 0 1
d 0 1 1 1 0 1 0 0
e 1 1 1 1 1 1 1 1
f 0 0 0 0 1 1 1 1
g 1 0 0 0 1 1 1 1
h 1 1 1 1 0 0 0 0
i 0 1 1 1 0 0 0 0
Convert from denary to binary (method1):
Convert from denary to binary (method2):
Steps :
1. This method involves successive division by 2.
2. The remainders are then read from BOTTOM to TOP to give the binary value.
3. Again using 107, we get:
The hexadecimal system
The hexadecimal system
• Hexadecimal system can be used by humans ,but computer can’t process it ,so the numbers must be
converted to binary .
• Hexadecimal(sometimes referred to as simply ‘hex’) is a base 16 system.
• Therefore needs to use 16 different ‘values’ to represent each digit.
• Because it is a system based on 16 different digits, the numbers 0 to 9 and the letters
A to F are used to represent each hexadecimal (hex) digit:
(A = 10, B = 11, C = 12, D = 13, E = 14 and F = 15.)
• Using the same method as denary and binary, this gives the headings
of 160
, 161
, 162
, 163
and so on.
The typical headings for a hexadecimal
number with five digits would be:
Convert Hex to Binary
Converting from hexadecimal to binary is also very straightforward.
Using the data in simply take each hexadecimal digit and write down the 4-bit code which
corresponds to the digit.
Example : 4 5 A
find the 4-bit code for each digit:
4 5 A
0 1 0 0 0 1 0 1 1 0 1 0
Put the groups together to form the binary number:
0 1 0 0 0 1 0 1 1 0 1 0
Example B F 0 8
Again just use :
B F 0 8
1 0 1 1 1 1 1 1 0 0 0 0 1 0 0 0
Then put all the digits
together: 1 0 1 1 1 1 1 1 0 0 0 0
1 0 0 0
Convert Binary to Hexadecimal:
Steps:
• Starting from the right
• split the binary number into groups of 4 bits.
• If the last group has less than 4 bits, then simply fill in with 0s from the left.
• Take each group of 4 bits and convert it into the equivalent hexadecimal digit.
Example 1 : 1 0 1 1 1 1 1 0 0 0 0 1
First split this up into groups of 4 bits and find the equivalent hexadecimal digits:
1 0 1 1 1 1 1 0 0 0 0 1
B (11) E(14) 1
Example 2:
1 0 0 0 0 1 1 1 1 1 1 1 0 1
First split this up into groups of 4 bits:
1 0 0 0 0 1 1 1 1 1 1 1 0 1
The left group only contains 2 bits, so add in two 0s:
0 0 1 0 0 0 0 1 1 1 1 1 1 1 0 1
the equivalent hexadecimal digits: 2 1 F(15) D(13)
Converting from hexadecimal to denary
Steps :
• First multiply each digit by its value:
• Add the totals together:
Example 1 : 4 5 A
denary number (total ) = 1 1 1 4
Converting from denary to hex:
To convert from denary to hexadecimal is a little more difficult.
As with the conversion from binary to denary, there are two very similar methods that can be used. Again, the first
method is ‘trial and error’ and the second method is more
methodical and involves repetitive division.
Method 1
first convert denary to binary then binary to hexadecimal from table.
Method2
This method involves successive division by 16. The remainders are then read from
BOTTOM to TOP to give the hexadecimal value. Again using 2004, we get:
Use of the hexadecimal system
Uses hexadecimal numbers are used in computer science:
1. Defining color code in HTML : HTML code is often used to represent colours of text on the computer screen. The
different intensity of the three primary colours (red, green and blue) RGB is determined by its hexadecimal value.
For example:#RRGGBB
• #FFFFFF represents colour white
• #000000 represents colour black
• #FF00 00 represents colour red
• #222222 represents lighter black
2. MAC address/physical /hardware address :
• A MEDIA ACCESS CONTROL (MAC) ADDRESS refers to a number which uniquely identifies a device on
the internet.
• Physical address/hardware address
• Is a static address .
• The MAC address refers to the network interface card (NIC) which is part of the device given by manufacturer.
• A MAC address is usually made up of 48 bits which are shown as six groups of
hexadecimal digits (although 64-bit addresses are also known):
NN:NN:NN:DD:DD:DD
where the first half (NN – NN – NN) is the identity number of the manufacturer of the device
the second half (DD – DD – DD) is the serial number of the device.
Use of the hexadecimal system
3. Used in assembly language/machine code.
4. ASCII CODE :Each character used on a keyboard has what is known as an
ASCII CODE (AMERICAN STANDARD CODE FOR INFORMATION
INTERCHANGE).
These codes can be represented using hexadecimal values or decimal
values.
ASCII, was designed to represent only basic English characters using
8bits numbers.
Unicode was designed to support characters from all languages around
the world using 16/32 bits numbers . While ASCII only uses
one byte (8bits) to represent each character, Unicode supports up to
4 bytes (32bits) for each character , this means that all characters can
be developed in different alphabets and symbols such as emojis .
Use of the hexadecimal system
5. Web addresses. URL :
• A good example of the use of ASCII codes is the representation of a web address
(or URL, which stands for uniform resource locator) such as www.hodder.co.uk
which becomes (using hexadecimal values):
(Note: the % sign is used to denote that hexadecimal is being used.)
6. Memory dump
7. Error messages
8. Location in memory
Use of the hexadecimal system
Why hexadecimal is used to represent binary number?
• easier for programmers to read and understand.
• easier to find errors.
• conversion to binary easier than denary to binary.
• more can be displayed on a screen for addresses etc. // smaller display screens can be used.
• faster than binary for entering numbers.
Binary manipulation and negative numbers
Binary addition:
Addition is done exactly like adding decimal numbers, you have only two digits (0 and 1).
Four rules to remember :
• 0+0 = 0, with no carry,
• 1+0 = 1, with no carry,
• 1+1 = 10 ( means 2). So the result is 0 and carry 1.
• 1+1+1 = 11 ( means 3) . So the result is 1 and carry 1
Example 1 : 1011 + 10010 = 11101:
Example 2 : 1010110 + 110100 = 10001010:
1
0 0 0 0 1 0 1 1
+ 0 0 0 1 0 0 1 0
0 0 0 1 1 1 0 1
1 1 1 1
0 1 0 1 0 1 1 0
+ 0 0 1 1 0 1 0 0
1 0 0 0 1 0 1 0
Binary manipulation and negative numbers
Binary addition: Overflow error
Explain what is meant by an overflow error or overflow condition.
This occurs when a calculation produces a result that is greater than that which a given storage location can store or
represent.
Every computer has a well-defined range of values that it can represent 8 bits or 16 bits …….
If during the execution of a program, it arrives at a number outside this range it will experience an overflow
error. The maximum number that can be represented using the 8-bit range will be 255.
A computer or a device has a predefined limit that it can represent or store, for example, 16-bit
• An overflow error occurs when a value outside this limit should be returned.
• Overflow will occur when 8 bits are expected to represent a number greater than 255.
110001 + 11100100 = 100010101:
Overflow. The carry-out is discarded, and the sum is not correct
10011011 + 1001010 = 11100101:
No overflow. Sum is correct.
1 1 1
0 0 1 1 0 0 0 1
+ 1 1 1 0 0 1 0 0
0 0 0 1 0 1 0 1
1 1 1
1 0 0 1 1 0 1 1
+ 0 1 0 0 1 0 1 0
1 1 1 0 0 1 0 1
Logical binary shift
• Logical shifts can be useful as efficient ways to perform multiplication or division of
unsigned integer by powers of two.
• Shifting left by n bits on an unsigned binary number has the effect of multiplying it by 2n
.
• Shifting right by n bits on an unsigned binary number has the effect of dividing it by
2n
(rounding towards 0).
• Example perform two logical shift to the right on the binary number 11101100
Left shift Right shift
Use two’s complement to represent negative 8-bit binary integers
In decimal, we use a minus sign to indicate a negative number. But the CPU and memory just know 1's and 0’s.
Two's complement is the way every computer I know of chooses to represent integers.
To get the two's complement negative notation of an integer:
• Write out the number in binary.
• Invert the digits (change 1 to 0 and 0 to 1)
• Add one to the result.
Example :
Using h 8 bit numbers
How do computers represent text Convert
Text to Binary:
When computer converts text to binary to be processed it uses a tool called character set .
All the characters and symbols that can be represented by a computer system.
• Each character and symbol is assigned a unique value.
A character set is a complete set of the characters and their number codes that can be recognized and represented
by a computer system, each character and symbol has unique value .
The types of character set are :
ASCII Code using 8 bits
Unicode using 16/32 bits
Why Unicode?
Adv . Unicode represents far more characters than ASCII (different alphabets and symbols such as emojis ).
Disadv. while Unicode supports a larger range of characters , and each character is encoded using more bits,
it also takes up a lot more space than ASCII.
How do computers represent images?
• A pixel is the smallest unit of a digital image or graphic that can be displayed and represented on a digital display device.
• Image resolution: refers to how many pixels are displayed per inch of an image, It is defined as width by height, or W x
H, where W is the number of horizontal pixels and H is the number of vertical pixels.
Ex : An HD display has a resolution of 1920(wide) x 1080(high) pixels.
• Color depth, also known as bit depth or pixel depth, refers to the number of bits per pixel on a computer monitor
and used to represent a specific color. The greater number of bits per pixel, the greater range of colors to be
represented .
• A color image is typically composed of red, green, and blue pixels to create color. Each of these colors is handled by your
computer and monitor as a “channel”.
8 bit color depth means : Having 8bit RGB means that you have 8 bits for each color channel (Red, Green, and Blue),
will have a total of 24-bits per pixel (8 for red, 8 for green, and 8 for blue).
A 16-bit RGB would have 48-bits per pixel((16 for red, 16 for green, and 16 for blue)
The higher the color depth and higher resolution the better image quality , but also higher file size
• Image files usually also contain metadata. Metadata means 'data about data' and provides information about the
image. The information includes:
file format - eg JPEG, GIF or PNG ,dimensions, resolution,colour depth…………
How do computers represent images?
Explain how the captured images are converted to digital photo files.
– Image is converted from analogue to digital (using ADC)
– Image is turned into pixels
– Each pixel is given a binary value
– Pixels form a grid (to create the image)
– 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
How do computers represent sounds?
Sampling is a method of converting an analogue audio
signal into a digital signal.
Sampling sound is the process of converting an
analogue sound wave into a digital signal.
Convert from analogue to digital is dependent on two
things:
• Sample rate
• Sample resolution
Sample rate :is how many samples, or measurements, of the
sound are taken each second. The more samples that are taken,
the higher the quality of the audio. Also, the shape of the sound
wave is captured more accurately.
A common audio sample rate for music is 44,100 samples per
second. The unit for the sample rate is hertz (Hz). 44,100 samples
per second is 44,100 hertz or 44.1 kilohertz (kHz).
How do computers represent sounds?
Sample resolution: the number of bits per sample
The red line is the wave that represents the audio data we are attempting to store.
Notice that there are 16 possible values that we can assign to the wave (from 0 through to 15).
These 16 values can be represented in 4 bits (since 4 bits allow us to store 16 unique values), so
we say that the data we are storing would have a resolution of 4 bits.
If we were to then reproduce the wave, it would end up looking like the green line on the image
This wave, would thus be stored using the following (decimal) values:
8, 9, 11, 13, 14, 15, 15, 15, 14, 13, 12, 10, 8, 7, 5, 3, 2, 1, 0, 0, 0, 1, 2, 4, 6, 7 Or, in binary representation:
1000, 1001, 1011, 1101, 1110, 1111, 1111, 1111, 1110, 1101, 1100, 1010,
1000, 0111, 0101, 0011, 0010, 0001, 0000, 0000, 0000, 0001, 0010, 0100,
0110, 0111
If we then count up the number of bits used to store this wave,
we would have 26 values x 4 bits = 104 bits = 13 bytes.
The higher the sample rate and higher sample resolution the higher
Sound quality, but also the higher file size
Measuring Data Storage
Bit: is the smallest unit of data, which holds either 1 or 0 (or on/off).
Nibble: is a sequence of 4 bits
Byte: A byte is a sequence of 8 bits.
Lossless and lossy file compression
File compression is a method in which the size of a file is reduced.
WHY benefits:
• To save disk space that the compress file takes up less storage space
• Easier and faster transmission over a network or the Internet:
• upload
• download
• Would not slow website down
• Take less bandwidth for transmitting file over the internet.
Types of file compression:
1. Lossless file compression : text files (emails , text messages ……)
2. Lossy file compression : image and sounds ………
Lossless and lossy file compression
Lossless file compression: file extention : .zip , .rar , ……
• All the data bits from the original file are reconstructed /restored when the file is again uncompressed. (Advantage )
• A (compression) algorithm is used.
• No data is removed in the process.
• Repeated patterns in text files are identified and indexed into a table, and the number of times the word/pattern appears is
stored in the table.
• Used with Ex . Text, spreadsheet files, emails,……
Lossy file compression:
• A compression algorithm is used.
• The file compression algorithm eliminates unnecessary bits of data as seen in MP3 and jpeg formats.
• It is impossible to get the original file back once it is compressed. (Disadvantage)
• This is why it is chosen for files where removing certain bits doesn’t detract from the quality.
Advantages :
• The file size will be smaller than lossless
• Requires less storage space
• Requires less time to transmit
Compress text file using lossless compression File Formats :
Text and number file formats
• Text and numbers can be stored in a number of formats.
• Text is usually stored in an ASCII format .
• It is important that the correct format is chosen if some form of processing is to be done.
• If number files undergo any form of file compression, then it tends to be lossless. Since it is very important that none of
the information/data is lost
Text files can also undergo file compression How?
• No data is removed in the process // original file can be restored
• These use complex compression algorithms that work on repeated sections of words :
Ex : The following section shows, in very simple terms, how this could work:
The phrase ‘THIS SECTION SHOWS YOU HOW THIS WOULD WORK’,, ignoring spaces, = 35
CHARACTERS 1 2 3 2 1 3
the compress text : 1 SECTION S2S Y3 2 1 W3LD WORK = 23 CHARATERS SAVE ABOUT 33%
1 for THIS
2 for
HOW 3
FOR OU
• Repeated words (are identified) , and are indexed/put into a table and are replaced with their index .
• their positions , and the number of times the word/pattern appears are stored (in the table) .
Compress sound files
File Formats : MPEG-3 (MP3) and MPEG-4 (MP4)
How to produce MP3:
• Using file compression algorithms which the original music file will be reduced by 90 per cent whilst still retaining
most of the music quality.
• Using PERCEPTUAL MUSIC SHAPING algorithm which :
• Removes sounds (unnecessary data from the file )that the human ear can’t hear properly.
• If two sounds are played at the same time, only the louder one can be heard by the human ear, so the softer
sound is eliminated.
• This means that certain parts of the music can be removed permanently without affecting the quality too
much.
• This means that the original file can’t be put back together again.
• This Reduces sample rate and resolution
• MP3 files use what is known as a LOSSY FILE COMPRESSION.
• the quality of MP3 files can be different since it depends on the sample resolution
Compress image files
File format : Joint Photographic Experts Group (jpeg) files
Image formats : - Raw bitmap formats such as TIFF and BMP are the highest image quality and highest file size
because they are not in a compressed format.
- jpeg, less file size because it is compressed format
How to convert to JPEG FORMAT :
• the size of the file is reduced.
• A compression algorithm is used
• Data will be lost/deleted permanently // original file cannot be recreated
• this reduced file size is reduced quality of the image.
• Reduce the range of colours used / colour depth / bits per pixel
• The human eye is limited in its ability to detect very slight differences in brightness and in color hues.
• Reduce the number of pixels ( image resolution) by removing colors that will not be recognized by human eye
Lossless image compression : A similar process of text compression can be applied to an image with lossless called run length
encoding , group together repeating pixels and store how many times occur.

More Related Content

PPTX
Number-Systems presentation of the mathematics
PPTX
04 chapter03 02_numbers_systems_student_version_fa16
PPTX
data representation
PPTX
Week 4-Number Systems.pptx
PPTX
clas 12th cbse board numbernumber system.pptx
PPTX
NUMBER SYSTEM.pptx
PDF
Digital Logic
PPTX
Number System.pptx
Number-Systems presentation of the mathematics
04 chapter03 02_numbers_systems_student_version_fa16
data representation
Week 4-Number Systems.pptx
clas 12th cbse board numbernumber system.pptx
NUMBER SYSTEM.pptx
Digital Logic
Number System.pptx

Similar to HexaDecimal-Number-Syatem-Use.-from-computer-science-subject-code-2210.docx (20)

PPT
010cb00356974412fr8b1af34b482e15d502.ppt
PDF
As Level Computer Science Book -1
PPTX
Digital logic fundaments,DLF,Number System
DOCX
Number system
PPT
2. Computer_Organization_unit_ 1_win.ppt
PPT
Topic 1 Data Representation
PPT
Topic 1 Data Representation
PPTX
1.1.1 BINARY SYSTEM
PPT
Cit 1101 lec 02
PDF
Digital Logic Computer Design lecture notes
PPTX
1.Digital Electronics overview & Number Systems.pptx
PPT
BEEE - Part B - Unit 3 PPT.ppt DL&CO - Unit 1 PPT.ppt
PPT
Number system
PDF
Digital Electronics Notes.pdf
PPT
1. basic theories of information
PPT
12117188.ppt
DOCX
Manoch1raw 160512091436
PDF
Computer system in binary , acsii, ICT ks3 / igcse
PPT
12117188.ppt
PPT
Numbersystemcont
010cb00356974412fr8b1af34b482e15d502.ppt
As Level Computer Science Book -1
Digital logic fundaments,DLF,Number System
Number system
2. Computer_Organization_unit_ 1_win.ppt
Topic 1 Data Representation
Topic 1 Data Representation
1.1.1 BINARY SYSTEM
Cit 1101 lec 02
Digital Logic Computer Design lecture notes
1.Digital Electronics overview & Number Systems.pptx
BEEE - Part B - Unit 3 PPT.ppt DL&CO - Unit 1 PPT.ppt
Number system
Digital Electronics Notes.pdf
1. basic theories of information
12117188.ppt
Manoch1raw 160512091436
Computer system in binary , acsii, ICT ks3 / igcse
12117188.ppt
Numbersystemcont
Ad

More from Orin18 (18)

PPTX
Addition and subtractknm,,,,,,,,,,,,,,,,,,ion .pptx
PPTX
nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn.pptx
PPTX
Fetch_Decode_hhhhhhhhhhhhhhhhhhhhExecute_Cycle.pptx
PPTX
Simple_Fetch_Decode_Executhhhhhhhe_Cycle.pptx
PPTX
lecture 1hhhhhhhhhhhhhhhhhhhhhhhhhh1 E PPT.pptx
PPTX
btwggggggggggggggggggggggggggggggisop correct (1).pptx
PPTX
Security_Systems,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,...
PPTX
vingautosaved-230525024624-6a6fb3b2.pptx
PPTX
Strings in python are surrounded by eith
PPT
gradiuyuuuuuuuuuuuuuuuuuuuuuuuuuuuuu.ppt
PPT
c=01uuuuuuuuuuuuuuuuuuuuuuuuuuuuiiii.ppt
PPTX
Phonics: Building Literacy Foundations.
PPTX
HTML table with example code-different types of HTML lists - ordered lists an...
PPTX
Lecture04 C PPT(c programming language ).pptx
PPTX
Lecture 02 M PPT Mathematics Geometry .pptx
PPTX
Lecture 01 M PPT geometry for primary class.pptx
PPTX
Lecture 01 M PPT geometry for primary class.pptx
PPTX
CH-7: Control-flow-in-python-programming-language.pptx
Addition and subtractknm,,,,,,,,,,,,,,,,,,ion .pptx
nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn.pptx
Fetch_Decode_hhhhhhhhhhhhhhhhhhhhExecute_Cycle.pptx
Simple_Fetch_Decode_Executhhhhhhhe_Cycle.pptx
lecture 1hhhhhhhhhhhhhhhhhhhhhhhhhh1 E PPT.pptx
btwggggggggggggggggggggggggggggggisop correct (1).pptx
Security_Systems,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,...
vingautosaved-230525024624-6a6fb3b2.pptx
Strings in python are surrounded by eith
gradiuyuuuuuuuuuuuuuuuuuuuuuuuuuuuuu.ppt
c=01uuuuuuuuuuuuuuuuuuuuuuuuuuuuiiii.ppt
Phonics: Building Literacy Foundations.
HTML table with example code-different types of HTML lists - ordered lists an...
Lecture04 C PPT(c programming language ).pptx
Lecture 02 M PPT Mathematics Geometry .pptx
Lecture 01 M PPT geometry for primary class.pptx
Lecture 01 M PPT geometry for primary class.pptx
CH-7: Control-flow-in-python-programming-language.pptx
Ad

Recently uploaded (20)

PPTX
UNIT-1 - COAL BASED THERMAL POWER PLANTS
PPTX
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
PPTX
Welding lecture in detail for understanding
PDF
Mohammad Mahdi Farshadian CV - Prospective PhD Student 2026
PPT
Project quality management in manufacturing
PPTX
OOP with Java - Java Introduction (Basics)
PPTX
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
PDF
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
PPTX
CH1 Production IntroductoryConcepts.pptx
PPTX
bas. eng. economics group 4 presentation 1.pptx
PPTX
Foundation to blockchain - A guide to Blockchain Tech
PDF
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
PDF
composite construction of structures.pdf
PPTX
Lecture Notes Electrical Wiring System Components
PDF
TFEC-4-2020-Design-Guide-for-Timber-Roof-Trusses.pdf
PPTX
KTU 2019 -S7-MCN 401 MODULE 2-VINAY.pptx
PDF
Enhancing Cyber Defense Against Zero-Day Attacks using Ensemble Neural Networks
PDF
Operating System & Kernel Study Guide-1 - converted.pdf
PPTX
additive manufacturing of ss316l using mig welding
PPT
Mechanical Engineering MATERIALS Selection
UNIT-1 - COAL BASED THERMAL POWER PLANTS
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
Welding lecture in detail for understanding
Mohammad Mahdi Farshadian CV - Prospective PhD Student 2026
Project quality management in manufacturing
OOP with Java - Java Introduction (Basics)
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
CH1 Production IntroductoryConcepts.pptx
bas. eng. economics group 4 presentation 1.pptx
Foundation to blockchain - A guide to Blockchain Tech
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
composite construction of structures.pdf
Lecture Notes Electrical Wiring System Components
TFEC-4-2020-Design-Guide-for-Timber-Roof-Trusses.pdf
KTU 2019 -S7-MCN 401 MODULE 2-VINAY.pptx
Enhancing Cyber Defense Against Zero-Day Attacks using Ensemble Neural Networks
Operating System & Kernel Study Guide-1 - converted.pdf
additive manufacturing of ss316l using mig welding
Mechanical Engineering MATERIALS Selection

HexaDecimal-Number-Syatem-Use.-from-computer-science-subject-code-2210.docx

  • 2. 1.1 Binary and hexadecimal system. What Is a Number System? Number system is a way to represent numbers. We are used to using the base-10 (0-9) number system, which is also called decimal/denary . Other common number systems include base-16 (hexadecimal 0-F), and base-2 (binary 0-1). What is the importance of binary system in computers? • Computers use binary because they can only read and store an on or off charge. Zero (0) is equivalent to off and one (1) is equivalent to on. • Computers use binary – the digits 0 and 1 – to store data. The circuits in a computer’s processor are made up of billions of transistors . • A transistor is a tiny switch that is activated by the electronic signals it receives. The digits 1 and 0 used in binary reflect the on and off states of a transistor. • Binary numbers can be considered the very basic representation of a number in an electronic device.
  • 3. Types of data: Analogue data / continuous : Analog data is data that is represented in a physical way, that is processed by humans , everything we can see, hear,smell is continous stream to our senses . Sound, videos and images are in analogue form. Digital Data / discrete : Data that are electromagnetically stored in the form of discrete digits with two values using binary digits 0,1 . Computers understand only digital data (binary) , so any data must be converted to binary (digital) to be save and processed by the computers .
  • 4. Number systems Denary /decimal system : • Base 10 using numbers 0-9 . • Most of the numbers used internationally are denary numbers . • Place value of denary goes up in factors of ten : ones , tens , hundreds , thousands ………….. ten thousands thousands hundreds Tens ones * 10 4 * 10 3 * 10 2 * 10 1 * 10 0 Example : the number 1478. 1 * 10 3 + 4 * 10 2 + 7 * 10 1 + 8* 10 0 = 1000 + 400 + 70 + 8 = 1478
  • 5. Binary system Denary /decimal system : • Base 2 using numbers 0-1 . • Used to represent data used by the processors . • The units for the binary number bit , nibble , byte , ………. • Place value of Binary goes up in factors of 2 . Place value 128 64 32 16 8 4 2 1 * 27 * 26 * 25 * 24 * 23 * 2 2 * 2 1 * 2 0 Example 1 0 1 0 1 1 0 1 Example : the number 10101101. convert to denary 1 * 2 7 + 0 * 2 6 + 1 * 2 5 + 0 * 2 4 + 1 * 2 3 + 1 * 2 2 + 0 * 2 1 + 1* 20 = 1*128 + 0*64 + 1 * 32 + 0 * 16 + 1 * 8 + 1 *4 + 0 * 2 + 1*1 = 128 + 0 + 32 + 0 + 8 + 4 + 0 + 1 = 173 128 + 32 + 8 + 4 + 1 = 173
  • 6. Converting from binary to denary (method1): It is fairly straightforward to change a binary number into a denary number. Convert the following binary numbers into denary: a 0 0 1 1 0 0 1 1 b 0 1 1 1 1 1 1 1 c 1 0 0 1 1 0 0 1 d 0 1 1 1 0 1 0 0 e 1 1 1 1 1 1 1 1 f 0 0 0 0 1 1 1 1 g 1 0 0 0 1 1 1 1 h 1 1 1 1 0 0 0 0 i 0 1 1 1 0 0 0 0
  • 7. Convert from denary to binary (method1):
  • 8. Convert from denary to binary (method2): Steps : 1. This method involves successive division by 2. 2. The remainders are then read from BOTTOM to TOP to give the binary value. 3. Again using 107, we get:
  • 9. The hexadecimal system The hexadecimal system • Hexadecimal system can be used by humans ,but computer can’t process it ,so the numbers must be converted to binary . • Hexadecimal(sometimes referred to as simply ‘hex’) is a base 16 system. • Therefore needs to use 16 different ‘values’ to represent each digit. • Because it is a system based on 16 different digits, the numbers 0 to 9 and the letters A to F are used to represent each hexadecimal (hex) digit: (A = 10, B = 11, C = 12, D = 13, E = 14 and F = 15.) • Using the same method as denary and binary, this gives the headings of 160 , 161 , 162 , 163 and so on. The typical headings for a hexadecimal number with five digits would be:
  • 10. Convert Hex to Binary Converting from hexadecimal to binary is also very straightforward. Using the data in simply take each hexadecimal digit and write down the 4-bit code which corresponds to the digit. Example : 4 5 A find the 4-bit code for each digit: 4 5 A 0 1 0 0 0 1 0 1 1 0 1 0 Put the groups together to form the binary number: 0 1 0 0 0 1 0 1 1 0 1 0 Example B F 0 8 Again just use : B F 0 8 1 0 1 1 1 1 1 1 0 0 0 0 1 0 0 0 Then put all the digits together: 1 0 1 1 1 1 1 1 0 0 0 0 1 0 0 0
  • 11. Convert Binary to Hexadecimal: Steps: • Starting from the right • split the binary number into groups of 4 bits. • If the last group has less than 4 bits, then simply fill in with 0s from the left. • Take each group of 4 bits and convert it into the equivalent hexadecimal digit. Example 1 : 1 0 1 1 1 1 1 0 0 0 0 1 First split this up into groups of 4 bits and find the equivalent hexadecimal digits: 1 0 1 1 1 1 1 0 0 0 0 1 B (11) E(14) 1 Example 2: 1 0 0 0 0 1 1 1 1 1 1 1 0 1 First split this up into groups of 4 bits: 1 0 0 0 0 1 1 1 1 1 1 1 0 1 The left group only contains 2 bits, so add in two 0s: 0 0 1 0 0 0 0 1 1 1 1 1 1 1 0 1 the equivalent hexadecimal digits: 2 1 F(15) D(13)
  • 12. Converting from hexadecimal to denary Steps : • First multiply each digit by its value: • Add the totals together: Example 1 : 4 5 A denary number (total ) = 1 1 1 4
  • 13. Converting from denary to hex: To convert from denary to hexadecimal is a little more difficult. As with the conversion from binary to denary, there are two very similar methods that can be used. Again, the first method is ‘trial and error’ and the second method is more methodical and involves repetitive division. Method 1 first convert denary to binary then binary to hexadecimal from table. Method2 This method involves successive division by 16. The remainders are then read from BOTTOM to TOP to give the hexadecimal value. Again using 2004, we get:
  • 14. Use of the hexadecimal system Uses hexadecimal numbers are used in computer science: 1. Defining color code in HTML : HTML code is often used to represent colours of text on the computer screen. The different intensity of the three primary colours (red, green and blue) RGB is determined by its hexadecimal value. For example:#RRGGBB • #FFFFFF represents colour white • #000000 represents colour black • #FF00 00 represents colour red • #222222 represents lighter black 2. MAC address/physical /hardware address : • A MEDIA ACCESS CONTROL (MAC) ADDRESS refers to a number which uniquely identifies a device on the internet. • Physical address/hardware address • Is a static address . • The MAC address refers to the network interface card (NIC) which is part of the device given by manufacturer. • A MAC address is usually made up of 48 bits which are shown as six groups of hexadecimal digits (although 64-bit addresses are also known): NN:NN:NN:DD:DD:DD where the first half (NN – NN – NN) is the identity number of the manufacturer of the device the second half (DD – DD – DD) is the serial number of the device.
  • 15. Use of the hexadecimal system 3. Used in assembly language/machine code. 4. ASCII CODE :Each character used on a keyboard has what is known as an ASCII CODE (AMERICAN STANDARD CODE FOR INFORMATION INTERCHANGE). These codes can be represented using hexadecimal values or decimal values. ASCII, was designed to represent only basic English characters using 8bits numbers. Unicode was designed to support characters from all languages around the world using 16/32 bits numbers . While ASCII only uses one byte (8bits) to represent each character, Unicode supports up to 4 bytes (32bits) for each character , this means that all characters can be developed in different alphabets and symbols such as emojis .
  • 16. Use of the hexadecimal system 5. Web addresses. URL : • A good example of the use of ASCII codes is the representation of a web address (or URL, which stands for uniform resource locator) such as www.hodder.co.uk which becomes (using hexadecimal values): (Note: the % sign is used to denote that hexadecimal is being used.) 6. Memory dump 7. Error messages 8. Location in memory
  • 17. Use of the hexadecimal system Why hexadecimal is used to represent binary number? • easier for programmers to read and understand. • easier to find errors. • conversion to binary easier than denary to binary. • more can be displayed on a screen for addresses etc. // smaller display screens can be used. • faster than binary for entering numbers.
  • 18. Binary manipulation and negative numbers Binary addition: Addition is done exactly like adding decimal numbers, you have only two digits (0 and 1). Four rules to remember : • 0+0 = 0, with no carry, • 1+0 = 1, with no carry, • 1+1 = 10 ( means 2). So the result is 0 and carry 1. • 1+1+1 = 11 ( means 3) . So the result is 1 and carry 1 Example 1 : 1011 + 10010 = 11101: Example 2 : 1010110 + 110100 = 10001010: 1 0 0 0 0 1 0 1 1 + 0 0 0 1 0 0 1 0 0 0 0 1 1 1 0 1 1 1 1 1 0 1 0 1 0 1 1 0 + 0 0 1 1 0 1 0 0 1 0 0 0 1 0 1 0
  • 19. Binary manipulation and negative numbers Binary addition: Overflow error Explain what is meant by an overflow error or overflow condition. This occurs when a calculation produces a result that is greater than that which a given storage location can store or represent. Every computer has a well-defined range of values that it can represent 8 bits or 16 bits ……. If during the execution of a program, it arrives at a number outside this range it will experience an overflow error. The maximum number that can be represented using the 8-bit range will be 255. A computer or a device has a predefined limit that it can represent or store, for example, 16-bit • An overflow error occurs when a value outside this limit should be returned. • Overflow will occur when 8 bits are expected to represent a number greater than 255. 110001 + 11100100 = 100010101: Overflow. The carry-out is discarded, and the sum is not correct 10011011 + 1001010 = 11100101: No overflow. Sum is correct. 1 1 1 0 0 1 1 0 0 0 1 + 1 1 1 0 0 1 0 0 0 0 0 1 0 1 0 1 1 1 1 1 0 0 1 1 0 1 1 + 0 1 0 0 1 0 1 0 1 1 1 0 0 1 0 1
  • 20. Logical binary shift • Logical shifts can be useful as efficient ways to perform multiplication or division of unsigned integer by powers of two. • Shifting left by n bits on an unsigned binary number has the effect of multiplying it by 2n . • Shifting right by n bits on an unsigned binary number has the effect of dividing it by 2n (rounding towards 0). • Example perform two logical shift to the right on the binary number 11101100 Left shift Right shift
  • 21. Use two’s complement to represent negative 8-bit binary integers In decimal, we use a minus sign to indicate a negative number. But the CPU and memory just know 1's and 0’s. Two's complement is the way every computer I know of chooses to represent integers. To get the two's complement negative notation of an integer: • Write out the number in binary. • Invert the digits (change 1 to 0 and 0 to 1) • Add one to the result. Example : Using h 8 bit numbers
  • 22. How do computers represent text Convert Text to Binary: When computer converts text to binary to be processed it uses a tool called character set . All the characters and symbols that can be represented by a computer system. • Each character and symbol is assigned a unique value. A character set is a complete set of the characters and their number codes that can be recognized and represented by a computer system, each character and symbol has unique value . The types of character set are : ASCII Code using 8 bits Unicode using 16/32 bits Why Unicode? Adv . Unicode represents far more characters than ASCII (different alphabets and symbols such as emojis ). Disadv. while Unicode supports a larger range of characters , and each character is encoded using more bits, it also takes up a lot more space than ASCII.
  • 23. How do computers represent images? • A pixel is the smallest unit of a digital image or graphic that can be displayed and represented on a digital display device. • Image resolution: refers to how many pixels are displayed per inch of an image, It is defined as width by height, or W x H, where W is the number of horizontal pixels and H is the number of vertical pixels. Ex : An HD display has a resolution of 1920(wide) x 1080(high) pixels. • Color depth, also known as bit depth or pixel depth, refers to the number of bits per pixel on a computer monitor and used to represent a specific color. The greater number of bits per pixel, the greater range of colors to be represented . • A color image is typically composed of red, green, and blue pixels to create color. Each of these colors is handled by your computer and monitor as a “channel”. 8 bit color depth means : Having 8bit RGB means that you have 8 bits for each color channel (Red, Green, and Blue), will have a total of 24-bits per pixel (8 for red, 8 for green, and 8 for blue). A 16-bit RGB would have 48-bits per pixel((16 for red, 16 for green, and 16 for blue) The higher the color depth and higher resolution the better image quality , but also higher file size • Image files usually also contain metadata. Metadata means 'data about data' and provides information about the image. The information includes: file format - eg JPEG, GIF or PNG ,dimensions, resolution,colour depth…………
  • 24. How do computers represent images? Explain how the captured images are converted to digital photo files. – Image is converted from analogue to digital (using ADC) – Image is turned into pixels – Each pixel is given a binary value – Pixels form a grid (to create the image) – 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
  • 25. How do computers represent sounds? Sampling is a method of converting an analogue audio signal into a digital signal. Sampling sound is the process of converting an analogue sound wave into a digital signal. Convert from analogue to digital is dependent on two things: • Sample rate • Sample resolution Sample rate :is how many samples, or measurements, of the sound are taken each second. The more samples that are taken, the higher the quality of the audio. Also, the shape of the sound wave is captured more accurately. A common audio sample rate for music is 44,100 samples per second. The unit for the sample rate is hertz (Hz). 44,100 samples
  • 26. per second is 44,100 hertz or 44.1 kilohertz (kHz).
  • 27. How do computers represent sounds? Sample resolution: the number of bits per sample The red line is the wave that represents the audio data we are attempting to store. Notice that there are 16 possible values that we can assign to the wave (from 0 through to 15). These 16 values can be represented in 4 bits (since 4 bits allow us to store 16 unique values), so we say that the data we are storing would have a resolution of 4 bits. If we were to then reproduce the wave, it would end up looking like the green line on the image This wave, would thus be stored using the following (decimal) values: 8, 9, 11, 13, 14, 15, 15, 15, 14, 13, 12, 10, 8, 7, 5, 3, 2, 1, 0, 0, 0, 1, 2, 4, 6, 7 Or, in binary representation: 1000, 1001, 1011, 1101, 1110, 1111, 1111, 1111, 1110, 1101, 1100, 1010, 1000, 0111, 0101, 0011, 0010, 0001, 0000, 0000, 0000, 0001, 0010, 0100, 0110, 0111 If we then count up the number of bits used to store this wave, we would have 26 values x 4 bits = 104 bits = 13 bytes. The higher the sample rate and higher sample resolution the higher Sound quality, but also the higher file size
  • 28. Measuring Data Storage Bit: is the smallest unit of data, which holds either 1 or 0 (or on/off). Nibble: is a sequence of 4 bits Byte: A byte is a sequence of 8 bits.
  • 29. Lossless and lossy file compression File compression is a method in which the size of a file is reduced. WHY benefits: • To save disk space that the compress file takes up less storage space • Easier and faster transmission over a network or the Internet: • upload • download • Would not slow website down • Take less bandwidth for transmitting file over the internet. Types of file compression: 1. Lossless file compression : text files (emails , text messages ……) 2. Lossy file compression : image and sounds ………
  • 30. Lossless and lossy file compression Lossless file compression: file extention : .zip , .rar , …… • All the data bits from the original file are reconstructed /restored when the file is again uncompressed. (Advantage ) • A (compression) algorithm is used. • No data is removed in the process. • Repeated patterns in text files are identified and indexed into a table, and the number of times the word/pattern appears is stored in the table. • Used with Ex . Text, spreadsheet files, emails,…… Lossy file compression: • A compression algorithm is used. • The file compression algorithm eliminates unnecessary bits of data as seen in MP3 and jpeg formats. • It is impossible to get the original file back once it is compressed. (Disadvantage) • This is why it is chosen for files where removing certain bits doesn’t detract from the quality. Advantages : • The file size will be smaller than lossless • Requires less storage space
  • 31. • Requires less time to transmit
  • 32. Compress text file using lossless compression File Formats : Text and number file formats • Text and numbers can be stored in a number of formats. • Text is usually stored in an ASCII format . • It is important that the correct format is chosen if some form of processing is to be done. • If number files undergo any form of file compression, then it tends to be lossless. Since it is very important that none of the information/data is lost Text files can also undergo file compression How? • No data is removed in the process // original file can be restored • These use complex compression algorithms that work on repeated sections of words : Ex : The following section shows, in very simple terms, how this could work: The phrase ‘THIS SECTION SHOWS YOU HOW THIS WOULD WORK’,, ignoring spaces, = 35 CHARACTERS 1 2 3 2 1 3 the compress text : 1 SECTION S2S Y3 2 1 W3LD WORK = 23 CHARATERS SAVE ABOUT 33% 1 for THIS 2 for HOW 3 FOR OU • Repeated words (are identified) , and are indexed/put into a table and are replaced with their index .
  • 33. • their positions , and the number of times the word/pattern appears are stored (in the table) .
  • 34. Compress sound files File Formats : MPEG-3 (MP3) and MPEG-4 (MP4) How to produce MP3: • Using file compression algorithms which the original music file will be reduced by 90 per cent whilst still retaining most of the music quality. • Using PERCEPTUAL MUSIC SHAPING algorithm which : • Removes sounds (unnecessary data from the file )that the human ear can’t hear properly. • If two sounds are played at the same time, only the louder one can be heard by the human ear, so the softer sound is eliminated. • This means that certain parts of the music can be removed permanently without affecting the quality too much. • This means that the original file can’t be put back together again. • This Reduces sample rate and resolution • MP3 files use what is known as a LOSSY FILE COMPRESSION. • the quality of MP3 files can be different since it depends on the sample resolution
  • 35. Compress image files File format : Joint Photographic Experts Group (jpeg) files Image formats : - Raw bitmap formats such as TIFF and BMP are the highest image quality and highest file size because they are not in a compressed format. - jpeg, less file size because it is compressed format How to convert to JPEG FORMAT : • the size of the file is reduced. • A compression algorithm is used • Data will be lost/deleted permanently // original file cannot be recreated • this reduced file size is reduced quality of the image. • Reduce the range of colours used / colour depth / bits per pixel • The human eye is limited in its ability to detect very slight differences in brightness and in color hues. • Reduce the number of pixels ( image resolution) by removing colors that will not be recognized by human eye Lossless image compression : A similar process of text compression can be applied to an image with lossless called run length encoding , group together repeating pixels and store how many times occur.