StdSupport-NumberSystem(encrypted)
StdSupport-NumberSystem(encrypted)
HANDOUT
Number System
Number System
“A number system is a method of calculation and counting and working with digits and
numbers.”
Scientists and mathematicians use four numbers systems as follows:
System radix/base: The number of digits allowed by a number system is known as base or
radix of that number system.
SAMREEN NISAR
OR
The number of values that can be expressed by a single digit in any number system is
called system radix.
Place value: The position of each digit in a number. (Always counted from right hand side)
In binary number system
128 64 32 16 8 4 2 1
2 7
2 6
2 5
2 4
2 3
2 2
2 1
20
SAMREEN NISAR
Hexadecimal to Binary 4 bits relation (right to left)
Binary counting may be represented (by adding each bit’s value) using binary scale as
follows:
128 64 32 16 8 4 2 1
0 0 0 0 0 0 0 1 1
Decimal numbers
0 0 0 0 0 0 1 0 2
0 0 0 0 0 0 1 1 3
0 0 0 0 0 1 0 0 4
0 0 0 0 0 1 0 1 5
0 0 0 0 0 1 1 0 6
0 0 0 0 0 1 1 1 7
0 0 0 0 1 0 0 0 8
0 0 0 0 1 0 0 1 9
0 0 0 0 1 0 1 0 10
Page 2
Binary numbers
Bit: Short for binary digit. The smallest unit of information handled by a computer. One bit
expresses a 1 or a 0 in a binary numeral, or a true or false logical condition, and is represented
physically by an element such as a high or low voltage at one point in a circuit or a small spot
on a disk magnetized one way or the other.
Byte: Short for binary term. A unit of data, today almost always consisting of 8 bits. A byte
can represent a single character, such as a letter, a digit, or a punctuation mark.
Conversion of positive denary integers into binary and positive binary integers into denary
SAMREEN NISAR
Method 1:
(26)10 = ( ? )2
Since the denary number (base 10) needs to be converted into the binary number (base 2),
therefore the number has to be divided by 2.
Method 2:
(42)10 = ( ? ) 2
Use the binary scale and mark a “1” (on) to the bits positions that add up to make 42.
i.e. 32 + 8 + 2 = 42
128 64 32 16 8 4 2 1
Page 3
1 0 1 0 1 0 = 42
Method 1:
(101)2 = ( ? )10
Since Binary number needs to be converted to denary therefore each digit of binary number
will be multiplied with 2 representing its power in base 10, and their products will be added
together. e.g.
Method 2:
SAMREEN NISAR
(11010)2 = ( ? )10
We may also use the binary scale to find out what this binary integer represents in denary
(decimal) number system.
128 64 32 16 8 4 2 1
1 1 0 1 0 = 26
Simply place the binary digits on their bit positions on the binary scale and add them.
Page 4
= (1101010)2
=1X26+1X25+0X24+1X23+0X22+1X21+0X20
= 64 + 32 + 0+ 8 + 0 + 2 + 0
= (106) 10
SAMREEN NISAR
Method # 2:
There is also a direct method to convert a binary number into hexadecimal number −
grouping which is explained as following below.
Using Grouping
Since, there are only 16 digits (from 0 to 7 and A to F) in hexadecimal number system, so
we can represent any digit of hexadecimal number system using only 4 bits as following
below.
Hexa 0 1 2 3 4 5 6 7 8 9 A B C D E F
Binary 0000 0001 0010 0011 01000 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111
SAMREEN NISAR
To convert a hexadecimal to a decimal manually, you must
start by multiplying the hex number by 16.
Then, you raise it to a power of 0 and increase that power by 1 each time according to the
hexadecimal number equivalent.
We start from the right of the hexadecimal number and go to the left when applying the
powers.
Each time you multiply a number by 16, the power of 16 increases.
When converting a C9 hexadecimal to a decimal your work should look something like
this:
Example 1
9 = 9 * (16 ^ 0) = 9
C = 12 * (16 ^ 1) = 192
Then, we add the results.
192 + 9 = (201)10
Example 2
In this example, we want to convert hex ABC to a decimal.
Remember that we raise the number 16 to 0 for the rightmost bit of the question.
Page 6
As we move across the numbers and letters, the power 16 is raised by one more than the
previous bit.
B = 11 * (16 ^ 1) = 176
A = 10 * (16 ^ 2) = 2560
Then, we add the results.
2560 + 176 + 12 = (2748)10
1. To convert from decimal to hexadecimal you must divide the decimal number by 16
repeatedly.
SAMREEN NISAR
2. Then, write the last remainder you obtained in the hex equivalent column.
3. If the remainder is more than nine, remember to change it to its hex letter equivalent.
For Example:
201 is a denary number, we will convert it into hexadecimal.
16 201
12 -- 9
12 = C
9=9
Decimal Numbers
The easiest way to understand bits is to compare them to something you know: digits.
A digit is a single place that can hold numerical values between 0 and 9. Digits are normally
combined together in groups to create larger numbers. For example, 6,357 has four digits. It
is understood that in the number 6,357, the 7 is filling the "1s place," while the 5 is filling the
10s place, the 3 is filling the 100s place and the 6 is filling the 1,000s place. So, you could
express things this way if you wanted to be explicit:
SAMREEN NISAR
Another way to express it would be to use powers of 10
What you can see from this expression is that each digit is a placeholder for the next higher
power of 10, starting in the first digit with 10 raised to the power of zero.
The reason computers use the base-2 system is because it makes it a lot easier to implement
them with current electronic technology. You could wire up and build computers that
operate in base-10, but they would be fiendishly expensive right now. On the other hand,
base-2 computers are relatively cheap.
So, computers use binary numbers, and therefore use binary digits in place of decimal digits.
The word bit is a shortening of the words "Binary digit." Whereas decimal digits have 10
possible values ranging from 0 to 9, bits have only two possible values: 0 and 1. Therefore, a
Page 8
binary number is composed of only 0s and 1s, like this: 1011. How do you figure out what
You can see that in binary numbers, each bit holds the value of increasing powers of 2. That
makes counting in binary pretty easy. Starting at zero and going through 20, counting in
decimal and binary looks like this:
0 0 11 1011
1 1 12 1100
2 10 13 1101
3 11 14 1110
4 100 15 1111
5 101 16 10000
6 110 17 10001
7 111 18 10010
8 1000 19 10011
9 1001 20 10100
10 1010
SAMREEN NISAR
When you look at this sequence, 0 and 1 are the same for decimal and binary number
systems. At the number 2, you see carrying first take place in the binary system. If a bit is 1,
and you add 1 to it, the bit becomes 0 and the next bit becomes 1. In the transition from 15
to 16 this effect rolls over through 4 bits, turning 1111 into 10000.
Bits are rarely seen alone in computers. They are almost always bundled together into 8-bit
collections, and these collections are called bytes. Why are there 8 bits in a byte? A similar
question is, "Why are there 12 eggs in a dozen?" The 8-bit byte is something that people
settled on through trial and error over the past 50 years.
With 8 bits in a byte, you can represent 256 values ranging from 0 to 255, as shown here:
0 = 00000000
1 = 00000001
2 = 00000010
...
254 = 11111110
255 = 11111111
Page 9
SAMREEN NISAR
Recognition of the use of binary numbers in computer systems
SAMREEN NISAR
form. For example, an operating system
would report a 1 terabyte hard disk's size as
1TB not as 1024GB, although both are
correct.
The microprocessor makes use of transistors that basically identify voltage levels rather than
any positive value in decimal number system. Therefore, a voltage level ‘high’ or ‘on’ will be
identified as ‘1’ and a voltage level of ‘low’ or ‘off’ will be identified as ‘0’. Binary number
system is therefore used for internal working of electrical computers / microprocessors.
SAMREEN NISAR
# FF 00 00 represents red #FF FF 00 represents yellow
# 00 FF 00 represents green #80 00 80 represents purple
# 00 00 FF represents blue #FF FF FF represents white
# FF 80 00 represents orange #00 00 00 represents black
By changing the intensities of red, green and blue, we can create almost any colour.
E.g. orange can be represented as #FFA500, which is (255 red, 165 green, 0 blue).
HTML Tags
Note: the tags are written b/w < > signs whereas attributes are written without containers.
Tags/ attributes Description / examples
Page 12
<h3> …… </h3>
<h4> ….. </h4>
<h5> ……. </h5>
<h6> …… </h6>
<p> ……… </p> Paragraph tag. creates paragraph for the text written in b/w.
<br /> Line break tag. Anything following it starts from the next line.
<hr /> To create a line from the current position to the right margin and
break the line.
<i> …… </i> To display content in italic format.
<b> …… </b> The content is shown in bold.
<u> ……. </u> To display content with underline.
align= “left” It is an attribute carried by <p> element which is used to indicate the
align=”center” alignment of the paragraph. example:
SAMREEN NISAR
align=”right” <p align="left">This is left aligned</p>
<p align="center">This is center aligned</p>
<p align="right">This is right aligned</p>
<img src=”image url” /> To insert any image in your webpage. If the image and html file are in
the same folder the whole file path(image url) is not necessary and we
can just give the correct file name and extension.
alt Used in <img /> tag to display text incase the image is not displayed
width To set the width of the image
height To set the height of the image
border To set the image border
Example:
<img src="/html/images/test.png" alt="Test Image" width="150"
height="100" border="3"/>
SAMREEN NISAR
bgcolor=“colorname without Eg. <body bgcolor="seablue">
space”
to give hexadecimal value we will write with a # sign example:
background=”image url” To set the background image. It can be used to set image background
on the whole webpage or on a table.
text=”colourname” To set the default color of the text displayed on the webpage. only
used with body tag.
<font color=”colorname”>…. To set font/ text color displayed anywhere on the webpage.
</font>
<font size=”1-7”> to set a size of the font
<font face=”fontstylename”> Sets the font style. example: times of new roman, verdana, comic sans
ms, wildwest, arial etc
<marquee> ……</marquee> to display simple text scrolling
<marquee to display scrolling text in both directions
behavior=”alternate”>
….</marquee>
<marquee to display the plain scrolling text with a pink background
bgcolor="pink">……
</marquee>
<marquee used to set the speed of the scrolling text. It takes amount in pixels
scrollamount=”50”>… moved per second.
Page 14
</marquee>
Parts of HTML
SAMREEN NISAR
An HTML document has two main parts: the head and
the body. But firstly, every HTML document should start by
declaring that it is an HTML document.
2. Presentation is the style you give the content. In most cases presentation is about the way
a document looks, but it can also affect how a document sounds – not everybody uses a
graphical web browser.
Page 15
SAMREEN NISAR
Examples of the manufacturer identifiers also called Organizationally Unique Identifier
(OUI)
Identity # of APPLE → 00 – 1C – B3
Identity # of DELL → 00 – 14 – 22
Identity # of CISCO → 00 – 40 – 96
Identity # of INTEL → 00 – A0 – C9
SAMREEN NISAR
Page 17
SAMREEN NISAR
w w w . c i e . c o . u k
%77 %77 %77 %2E %63 %69 %65 %2E %63 %6F %2E %75 %6B
6. Memory Dumps:
A “memory dump” is simply a listing of the contents of a section of a computer’s memory
(or possibly the entire contents). They are used primarily for debugging purposes since they
allow you to see exactly what is contained at each memory location in the dump. In memory
dumping hexadecimal values are preferred as they are easy to work with and understand.
SAMREEN NISAR
Hexadecimals are beneficial (over binary) because:
1. They are easier and faster to work with, taking up less screen space.
2. Mistakes are less likely and easier to trace / debug
3. Hexadecimal can be used to write large binary numbers in just a few digits.
4. It makes life easier as it allows grouping of binary numbers which makes it easier to
read, write and understand.
5. It is more human-friendly, as humans are used to grouping together numbers and
things for easier understanding.
Page 19
SAMREEN NISAR
Page 20
SAMREEN NISAR
Page 21
SAMREEN NISAR
Page 22