NSS-ICT‎ > ‎Unit A‎ > ‎

Chapter 03

Number and Character Coding System

Khan Academy: Number system and conversion


3.1 Denary (Base 10), BInary (Base 2) and Hexadecimal Number (Base 16) systems

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



3.2 Number System conversion



3.3 Bit, Byte and Word

 Unit Abbr  Remarks 
 Bit  
 Byte 1B = 8b 
 KiloByte KB  1KB = 210 = 1024B 
 MegaByte MB  1 MB = 1024 KB =  220 B
 GigaByte GB  1 GB = 1024 MB =  230 B
 TeraByte TB  1 TB = 1024 GB =  240 B

Transmission Speeds
 Unit  Abbr Remarks 
bit per second bps   
Kilobits per second kbps  1 kbps = 1000 bps 
Megabits per second  Mbps  1 Mbps = 1000 kbps 
Gigabits per second Gbps 1 Gbps = 1000 Mbps 


Signed and magnitude: The leftmost bit is known as signed bit that specifies the sign of a binary integer.



4 bit representation of integer using different method
 
Leftmost
MSB
  
rightmost
LSB
unsigned integer 
Signed and magnitude
1: negative
0: positive 
 2's complement  -8 


Word length  Unsigned Integer Signed and magnitude  2's Complement

 Minimum Maximum  Minimum  Maximum  Minimum  Maximum 
  4-bit  0000(2)
= 0
1111(2)
= 15 
= 24 - 1
 1111(2)
= -7
 0111(2)
= 7
 1000(2)
= -8
0111(2)
= +7 
  8-bit  00000000
= 0
11111111
=255 
= 28 - 1
 11111111
= -127
= - (27 - 1)
 01111111
= 127
=27 - 1
 10000000
= -128
= -27
 01111111
= 127
= 27 - 1
  16-bit 0  216 - 1
= 65535

 - (215 - 1)
= - 32767
 215 - 1  -215 
= -32768
 215 - 1
  24-bit  0  224 - 1 = 16777215  - (223 - 1) 223 - 1  -223   223 - 1 

4-bit
 unsigned signed and magnitude 2's complement 
 00000
 0001
 0010
 0011
 0100  4 4
 0101 5 5 5
 0110 6 6 6
 0111 7 7 7
 1000 8 0 -8
 1001 9 -1 -7
 1010 10 -2 -6
 1011 11 -3 -5
 1100 12 -4 -4
 1101 13 -5 -3
 1110 14 -6 -2
 1111 15 -7 -1

43 = 00101011

-43  sign & mag : 10101011

Express 43 in 2's complement (8 bits)

Method 1:
 For -ve number, the first bit must be 1 (-128)
 - 43 = -128 + 85

Convert 85 into binary (8-1 bits) : 1010101

       2's complement: 11010101


Method 2
 Example: The 8-bit representation of -43 using 2's complement

Step 1: Convert 43 to binary.   43 = 101011
Step 2: Add leading 0 up to 8-bit: 00101011
Step 3: Inverted all the bits           11010100  (1's complement)
Step 4: Add 1 to the bit pattern:    11010101


Activity 2 on P.89

Class work
Find out the 8-bit representation of -59, -110, -83 using 2's complement, signed and magnitude.

Try out: the 8-bit representation of -130 using 2's complement, signed and magnitude.

Practical 1
Using Google Spreadsheet or excel, tryout the following functions. (P.98-99 of texbook). Share the document to public and submit the hyperlink.
BIN2DEC
BIN2HEX
DEC2HEX
DEC2BIN
HEX2BIN
HEX2DEC

After completing the worksheet, please share your google sheet by putting your file in the share folder.


3.4 Addition and subtraction of different number representations

Class work: 

2's complement
Addition 


Nov 20 (Day 10):
Activities 4 (P.99)
Homework / Classwork: 
  P.104 - 106 (Do it on an exercise book)  ALL questions except LQ 2a (we do it in class)

Practical on Flash. (chapter 4: multimedia)


Short test on Nov 26 (Day 4) - Test on Chapter 3



3.5 Character coding systems

 Coding   Language  Length
ASCII  English  1 Byte 
GB simplified Chinese  2 Bytes 
BIg 5 Traditional Chinese  2 Bytes 
 Unicode Multi-language  variable length (2, 3, 4 Bytes) 

GB, Big 5, Unicode are compatible with ASCII

P.107 Long questions
Q1. 
床前明月光,疑是地上霜。舉頭望明月,低頭思故鄉。


P.103 Self-assessment corner (homework - submit on





Comments