0% found this document useful (0 votes)
51 views

1 Data Representation

Here are the solutions to the Class Test questions: 1. (110101)2 = 5310 2. 250 10 = 1111101002 3. (FEA2)16 = 111111 1010 001012 4. (100101)2 = 2110 5. 50 10 = 31002 6. (2BC8)16 = 11101011 110001002 7. (111001)2 = 5710 8. 3810 = 1001102 9. (128)16 = 100000002

Uploaded by

Andrew Raj
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
51 views

1 Data Representation

Here are the solutions to the Class Test questions: 1. (110101)2 = 5310 2. 250 10 = 1111101002 3. (FEA2)16 = 111111 1010 001012 4. (100101)2 = 2110 5. 50 10 = 31002 6. (2BC8)16 = 11101011 110001002 7. (111001)2 = 5710 8. 3810 = 1001102 9. (128)16 = 100000002

Uploaded by

Andrew Raj
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 36

1 Data

representation
1.1 NUMBER SYSTEMS
Understand how and why computers use
binary to represent all forms of data
Introduction: Binary System
-Binary system works in base of 2
-The only possible values are 0 or 1 
-A typical binary value is a string of 0s and 1s e.g. 0101010000 
-Computer has to translate every single instruction into Binary
Translation of ‘Welcome’ in Binary would be: 
01010111 01100101 01101100 01100011 01101111 01101101 01100101
Why does Computer Store Data in Binary

-Computeruses logic circuit / switches​


-They work in only two states / On or Off / True or False / 1 or 0.

Use of Binary Numbers in Computer Systems / Registers:​

-Data
-Instruction 
-Number 
-Part of image / small image 
-A sound / sound sample / small soundtrack 
-ASCII value / Unicode value / character 
EXPLAIN THE DIFFERENCES BETWEEN BINARY AND DENARY
SYSTEM
• -A binary number system is a base -2 system 

• -denary number system is a base-10 system 

• -A binary number system uses 0 and 1 values/ denary number system uses 0 to 9 values  

CONVERSION FROM BINARY TO DECIMAL/DENARY (BASE 10)

1. 010 2 = 2 10

2. 1001 2 = 910

3. 100011 2 = 35 10

4. 1001001 2 =?

 7310
CONVERSION FROM DECIMAL/DENARY TO BINARY
10010 = ?2
01001011

10001110
00000001 01010011
Introduction: Hexadecimal number system
• Base -16 number system
• 16 unique symbols: 0-9 and letters A-F
• Decimal 10=A, 11=B, 12=C, 13=D, 14=E, 15=F
• Hexadecimal numbers can represent every byte (8 bits) as two
hexadecimal digits.
• Easier for humans to read hexadecimal rather than binary.
E.g: 3AD16 ,A2B16
Hexadecimal to binary

1. A2B16 1010 0010 10102

2. 3016 0011 00002

Practice Problems
1. Convert FDA16 to an equivalent binary number

2. Convert 98B16 to an equivalent binary number

3. Convert 5C16 to an equivalent binary number

4. Convert 10016 to an equivalent binary number


Binary to Hexadecimal

The binary to hexadecimal conversion table


where 1 hexadecimal number is equivalent to 4
binary numbers. 

01110001010012

0 1110 0010 10012

0000 1110 0010 10012

0 E 2 916

0E2916
Binary to Hexadecimal
11010102

110 10102

011010102

6 A16

6A16

1010100010111

0001 0101 0001 0111

1 5 1 7 16

111100111101111

0111 1001 1110 1111

7 9 E F 16
Decimal to Hexadecimal
910 ? 16

(8976)10 ? 16

(2310)16
9870 ? 16
Hexadecimal to Decimal

AF1016

= (3246)10
= 40960 + 3840 + 16
= (44816)10
L.O: Understand how and why hexadecimal is
used as a beneficial method of data representation.

• Hex is useful because large numbers can be represented using fewer digits.

• For example, color values and MAC addresses are often represented in hex.

• Additionally, hex is easier to understand than binary.

• Programmers often use hex to represent binary values as they are simpler to write and check than
when using binary.
• Hexadecimal is easier to debug and locate errors in data.
1.2 Binary Manipulation and
Negative numbers
• Binary Addition:
Binary Addition example
Practice problem in binary addition
1100101 + 101000

010001101

101000000 + 10010

0101010010
Add two positive 8-bit binary integers
An overflow error will occur if the value is greater
than 255 in an 8-bit register
Negative Binary Numbers
How negative numbers represent as binary?
The methods exist that can be used to represent negative binary numbers and it is called two’s complement.

2’s Complement method:


• First invert all the values in the binary number ( change the 1s to 0s and 0s to 1s), then add 1 to the result.

For Example:

• 45 binary number is 101101 form it as 8-bit number 0010 1101

• To get –45 :
• Invert the value of 45 1101 0010
• Add 1 with inverted values 1
1101 0011 (not the values is -45)
2’s Complement method:
Example #1
5 = 00000101
Complement Digits

11111010
+1
Add 1
-5 = 11111011

Example #2
-13 = 11110011
Complement Digits

00001100
+1
Add 1
13 = 00001101
Logical Binary Shifts
PAST PAPER 0478-2021-oct-nov-0478-w21-qp-11
PAST PAPER 0478-2021-oct-nov-0478-w21-qp-12
PAST PAPER 0478-2021-oct-nov-0478-w21-qp-12
PAST PAPER 0478-2021-oct-nov-0478-w21-qp-13
PAST PAPER 0478-2021-oct-nov-0478-w21-qp-13
PAST PAPER 0478-2021-oct-nov-0478-w21-qp-13
PAST PAPER 0478/12/F/M/21

(b) Give the largest denary value that can be stored in the 8-bit binary 255
register.
PAST PAPER 0478-2021-oct-nov-0478-w21-qp-13

(b) Give two benefits, to users, of converting binary values to hexadecimal.

(c) Hexadecimal is used to represent Hypertext Markup Language (HTML)


color codes in computer science. Identify three other ways that
hexadecimal is used in computer science
PAST PAPER 0478-2021-oct-nov-0478-w21-qp-13

(ii) The values in the MAC address are hexadecimal values. Convert the three given
hexadecimal values into 8-bit binary.
14 ......................................................................................................................................
A0 ......................................................................................................................................
C9 ......................................................................................................................................

(iii) Convert the two given hexadecimal values into denary.


29......................................................................................................................................
C8......................................................................................................................................
Class Test 18 Marks
• Convert (110101) 2 to Decimal. 2 Marks

• Convert 250 10 to binary. 2 Marks

• Convert (FEA2) 16 to binary. 2 Marks

• Convert (100101) 2 to ? 10 2 Marks

• Convert 50 10 to 210. 2 Marks

• Convert (2BC8) 16 to 210. 2 Marks

• Convert (111001) 2 to Decimal. 2 Marks

• Convert 38 10 to binary. 2 Marks

• Convert (128) 16 to binary. 2 Marks 8-09-22

You might also like