Google
 
Site navigation: [ Home | Theory | Java | About ]

Number systems

3.5.3 Number systems

 

 

 

 

 

 

In the IB Computer Science program we are only interested in binary , decimal and hexadecimal (base 16).

 

 

 

 

Any binary byte can be represented as 2 hexadecimal digits by substituting in the above table. Our old buddy

22 - 00010110

becomes 16 in hexadecimal

0001  0110
1        6

 

On this page: [ number systems | intro to architecture ]

We have considered the binary number system (base 2):

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

The above represents decimal 22.

Number systems
Other bases are possible, we are also familiar with base 10 (or decimal) numbers. Consider:

Base
Symbols Examples Decimal equivalents
2
0, 1 1, 10, 1010, 10000 1, 2, 10, 16
3
0, 1, 2 1, 2, 101, 121 1, 2, 10, 16
8
0, 1, 2, 3, 4, 5, 6, 7 1, 2, 12, 20 1, 2, 10, 16
10
0, 1, 2, 3, 4, 5, 6, 7, 8, 9 1, 2, 10, 16 1, 2, 10, 16
16
0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
A, B, C, D , E, F
1, 2, A, 10 1, 2, 10, 16

Hexadecimal is interesting because it can be used as a shorthand form of binary, as follows: 

Binary

Hexadecimal

Binary

Hexadecimal

0000

0

1000

8

0001

1

1001

9

0010

2

1010

A

0011

3

1011

B

0100

4

1100

C

0101

5

1101

D

0110

6

1110

E

0111

7

1111

F

Try a quick conversion quiz:

Source code for this Applet

NB: do not type leading zeroes in answers (especially binary)

As we mentioned in the first worksheet, 24-bit colour is often used to represent colours in a modern system. That is 3 binary bytes, each byte stands for red component, green component, blue component (RGB colour). Graphically:

red

green

blue

11111111

11111111

11111111

binary

FF

FF

FF

hex

So, each colour can be described in 6 hex digits. FFFFFF is white. What colours do you think these hex numbers represent?

                      a)  FF0000       b)  00FF00       c)  000000  

What might be the code for cyan (an equal mixture of blue and green)?

The ASCII code for a space is 20 in hexadecimal; what is it in decimal?

The ASCII code for the letter A is 65 in decimal. What is it in binary?

Back to top

Introduction to Architecture

A simplified diagram of computer memory might be as shown on the right:

The first 4 numbers might represent memory locations. The second column could be program insructions (these would, of course, be in binary form too). The third column represents data locations.

Notice that oth data and program instructions can be held in RAM.

How many different address locations can this computer have?

Data and instructions are sent from the RAM (primary memory) to the CPU (central processing unit) to be processed.

Each bit is sent along a wire/circuit so 4 sets of wires would be needed in this computer. The group of wires/circuits is called a bus .

Buses carry data and addresses.

Computers typically have 32, 64 or 128 bit buses. How many different addresses can a computer with a 32-bit bus have?

How much is that in Megabytes (MB)?

Back to top

related: [ Core home | previous: representation | next: analog/digital ]

Here is another pdf worksheet for this section.


 
The site is partly financed by advertising revenue, partly by online teaching activities and partly by donations. If you or your organisation feel these resouces have been useful to you, please consider a donation, $9.95 is suggested. Please report any issues with the site, such as broken links, via the feedback page, thanks.

Questions or problems related to this web site should be addressed to Richard Jones who asserts his right to be identified as the author and owner of these materials - unless otherwise indicated. Please feel free to use the material presented here and to create links to it for non-commercial purposes; an acknowledgement of the source is required by the Creative Commons licence. Use of materials from this site is conditional upon your having read the additional terms of use on the about page and the Creative Commons Licence. View privacy policy.

Creative Commons License


This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 2.5 License. © 2001 - 2009 Richard Jones, PO BOX 246, Cambridge, New Zealand;
This page was last modified: October 28, 2013