Вы находитесь на странице: 1из 3

Computer and Information Technology – Core Module – Data Representation p.

Computer & Information Technology


Data Representation
Common Number System:
System Name Base Number used Remark
Decimal / Denary 10 0–9 Human understandable

Binary 2 0, 1 Employed by computer

Hexadecimal 16 0–9 Usually used as a shorter way to


represent binary numbers
A (11) – F (15)

Conversions between different number systems:


1. Decimal → Binary
Convert 3410 to binary number
2 34 …
2 17 … 0
2 8 … 1
2 4 … 0
2 2 … 0
1 … 0

3410 = 1000102.

2. Binary → Decimal
Convert 1011012 into denary number
25 24 23 22 21 1
↓ ↓ ↓ ↓ ↓ ↓
1 0 1 1 0 1

1011012 = 25 + 23 + 22 + 1= 4510

3. Decimal → Hexadecimal
Convert 350810 into hexadecimal number
1 3508 …
6
1 219 …4
6
1 13 (D) … 11 (B)
6
350810 = DB416.
Computer and Information Technology – Core Module – Data Representation p.2

4. Hexadecimal → Decimal
Convert 2A36C2 into denary number
164 163 162 161 1
↓ ↓ ↓ ↓ ↓
2 A(10) 3 6 C(12)

2A36C16 = 2 × 164 + 10 × 163 + 3 × 162 + 6 × 161 + 12 = 17290810

5. Binary ←→ Hexadecimal
Binary Decimal Hexa Binary Decimal Hexa
0000 0 0 1000 8 8
0001 1 1 1001 9 9
0010 2 2 1010 10 A
0011 3 3 1011 11 B
0100 4 4 1100 12 C
0101 5 5 1101 13 D
0110 6 6 1110 14 E
0111 7 7 1111 15 F

(a) Convert 1010011012 into hexadecimal number.


1 0100 11012 = 0001 0100 11012 = 14D16
(b) Convert 5E2D16 into binary number.
5E2D = 0101 1110 0010 11012 = 1011110001011012

Important Numbers and Formulas


1. 27 = 128
28 = 256
210 = 1024
216 = 65536
2. 10……02 (n zeroes) = 2n.
e.g. 1000000002 = 28 = 256
3. For n-bits unsigned integers:
Minimum number = 00……0 (n zeroes) = 0
Maximum number = 11……1 (n ones) = 2n – 1
e.g. For 8-bits unsigned integers:
Minimum = 00000000 = 0
Maximum = 11111111 = 28 – 1 = 255
* If a number requires more than the available number of bits, overflow will
occurs. The leftmost bits will be removed.
Computer and Information Technology – Core Module – Data Representation p.3

Memory Unit
1. Bit
 BInary digiT
 Basic unit for storing data in computer
 1 bit = 1 binary digit (i.e. 0, 1)
2. Byte
 Smallest addressable data in the microprocessor
 1 Byte = 8 bits
3. Measurement units of data
Unit Value
1 Kilobyte (1KB) 210 bytes
1 Megabyte (1MB) 210 KB = 220 bytes
1 Gigabyte (1GB) 210 MB = 230 bytes
1 Terabyte (1TB) 210 GB = 240 bytes

* a. We use “B” to stand for “byte”, “b” to stand for “bit”


b. When memory size is discussed, we usually use 2 as the base.

Character Coding Systems / Character Sets (Charsets)


1. ASCII
 8 bits for each character
 Printable characters + Non-printable (control and communication) codes
 “0” – “9”: 48 – 57
“A” – “Z”: 65 – 90
“a” – “z”: 97 – 122
2. Big-5 Code
 16 bits for each character
 Mainly used to represent Traditional Chinese characters (繁體中文)
3. GB Code
 16 bits for each character
 Mainly used to represent Simplified Chinese characters (簡體中文)
4. Unicode
 16 bits
 International standard code
 Support characters from different languages, including Traditional and
Simplified Chinese characters
 Increasing degree of recognition in different systems
* Conversion is needed to read characters from one charset to another.