0% found this document useful (0 votes)
128 views21 pages

AS and A Level Computer Science Presentations

Powerpoint presentation for computer science AS & A level.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
128 views21 pages

AS and A Level Computer Science Presentations

Powerpoint presentation for computer science AS & A level.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 21

Computer Science

For Cambridge International AS & A Levels


Data Representation
Objectives
Students should be able to:
 Show understanding of binary magnitudes and the difference between
binary prefixes and decimal prefixes
 Show understanding of different number systems
 Perform binary addition and subtraction
 Describe practical applications where Binary Coded Decimal (BCD) and
Hexadecimal are used
 Show understanding of and be able to represent character data in its
internal binary form, depending on the character set used
Number systems
Denary numbers
As children, we learnt to count using 1, 2, 3, 4, 5, 6, 7, 8, 9, 10. We use these
numbers in our everyday life.
Specifically, This gives us ten different symbols to represent each individual
digit. This is therefore a base-10 number system.
Numbers in this system are called denary numbers or, decimal numbers. When
a number is written down the value that it represents is defined by the place
values of the digits in the number.
For Example, the denary number 346 is interpreted as shown
Binary numbers
The binary number system is base-2. Each binary digit is written with either of
the symbols 0 and 1. A binary digit is referred to as a bit.
Just like a denary number, the value of a binary number is defined by place
values. For example, the value the binary number 101110 is shown below.

By adding up the values in the bottom row you can see that the binary number
101110 has a value which is equivalent to the denary number 46.
All software used by the hardware uses binary codes which consist of bits.
Binary codes are most often based on the use of one or more groups of eight
bits. A group of eight bits is called a byte.
Hexadecimal numbers
These are base-16 numbers where each hexadecimal digit is represented by
one of the following symbols: 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F. The symbols A
through to F represent the denary values 10 through to 15. The value of a
number is defined by place values. For example, the value of hexadecimal
number 2A6.

The nibble as a group of four bits. A nibble can be represented by one


hexadecimal digit. This means that each byte of binary code can be written as
two hexadecimal digits. Two examples are shown in Table 1.04 together with
their denary equivalent.
One example when you will see hexadecimal representations of bytes is when
an error has occurred during the execution of a program.
A memory dump could be provided which has a hexadecimal representation of
the content of some chosen part of the memory.
Another use is when the bytes contain binary numbers in the charts that define
character codes.
Converting between binary and denary numbers
One way of converting a binary number to a denary number is to add up the
place values for every digit that has a value.
WORKED EXAMPLE
Convert the binary number 11001 to the denary number 25:
To carry out the conversion you start at the most significant bit and successively
multiply by two and add the result to the next digit
Convert a denary number to binary
A useful way to convert a denary value to its binary equivalent is the procedure of
successive division by two with the remainder written down at each stage. The
converted number is then given as the set of remainders in reverse order.
WORKED EXAMPLE
Convert denary 246 to binary:
Conversions for hexadecimal numbers
It is possible to convert a hexadecimal number to denary by using the method
discussed above.
However, if there are more than a few digits, the numbers involved in the conversion
become very large. Instead, the sensible approach is to first convert the hexadecimal
number to a binary number which can then be converted to denary.
To convert a hexadecimal number to binary, each digit is treated separately and
converted into a 4-bit binary equivalent, remembering that F converts to 1111, E
converts to 1110 and so on.
To convert a binary number to hexadecimal you start with the four least significant
bits and convert them to one hexadecimal digit. You then proceed upwards towards
the most significant bit, successively taking groupings of four bits and converting each
grouping to the corresponding hexadecimal digit.
Work to do
Convert the following denary numbers into hexadecimal numbers.
1. 96
2. 215
3. 374
Convert each of the hexadecimal numbers to denary numbers.
4. B4
5. FF
6. 3A2C
Work to do
Convert the following denary numbers into hexadecimal numbers.
1. 96
Divide 96 by 16:
96÷16=6 remainder 0
So, 96 in hexadecimal is 60.
2. 215
Divide 215 by 16:
215÷16=13 remainder 7
13 in hexadecimal is D, and the remainder 7 stays the same.
So, 215 in hexadecimal is D7.
Convert the following denary numbers into hexadecimal numbers.
3. 374
Divide 374 by 16:
374÷16=23 remainder 6
Divide 23 by 16:
23÷16=1 remainder 7
1 stays as 1, 7 as 7, and 6 as 6.
So, 374 in hexadecimal is 176
Convert each of the hexadecimal numbers to denary numbers.
4. B4
Convert each of the hexadecimal numbers to denary numbers.
5. FF
Convert each of the hexadecimal numbers to denary numbers.
6. 3A2C
Numbers and quantities
There are several different types of numbers within the denary system.
How large values are represented.
Quantity that includes units of measurement, can be written in three different
ways. For example, a distance could be written in any one of these three ways:
• 23 567 m
• 23.567 × 10 3 m
• 23.567 km
The second example has used an exponential notation to define the magnitude
of the value. The third example has added a prefix to the unit to define this
magnitude. We read this as 23.567 kilometres.

The ‘kilo’ is an example of a decimal prefix. There are four decimal prefixes
commonly used for large numbers.
Unfortunately, for a long time the computing world used these prefix names but
with a slightly different definition. The value for 210 is 1024. Because this is close
to 1000, computer scientists decided that they could use the kilo prefix to
represent 1024.
For example, if a computer system had the following values quoted for the
processor speed and the size of the memory and of the hard disk:
Processor speed 1.6 GHz
Size of RAM 8 GB
Size of hard disk 400 GB
The prefix G would represent 109 for the processor speed but would almost
certainly represent 1024 × 1024 × 1024 for the other two values.

This unsatisfactory situation has now been resolved by the definition of a new
set of names which can be used to define a binary prefix.

You might also like