Computer and Information Technology – Core Module – Data Representation
Computer & Information Technology Data Representation Common Number System: System Name Decimal / Denary
Base 10
Number used 0–9
Remark 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 0 1 1 0 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.
1 ↓ 1
p.1
Computer and Information Technology – Core Module – Data Representation
4.
p.2
Hexadecimal → Decimal Convert 2A36C2 into denary number 164 163 162 161 ↓ ↓ ↓ ↓ 2 A(10) 3 6
1 ↓ C(12)
2A36C16 = 2 × 164 + 10 × 163 + 3 × 162 + 6 × 161 + 12 = 17290810
5.
Binary ←→ Hexadecimal Binary 0000 0001 0010 0011 0100 0101 0110 0111
Decimal 0 1 2 3 4 5 6 7
Hexa 0 1 2 3 4 5 6 7
Binary 1000 1001 1010 1011 1100 1101 1110 1111
Decimal 8 9 10 11 12 13 14 15
Hexa 8 9 A B C D E 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
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 1 Kilobyte (1KB) 1 Megabyte (1MB) 1 Gigabyte (1GB) 1 Terabyte (1TB)
*
a. b.
Value 210 bytes 210 KB = 220 bytes 210 MB = 230 bytes 210 GB = 240 bytes
We use “B” to stand for “byte”, “b” to stand for “bit” 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.
p.3