0% found this document useful (0 votes)
383 views20 pages

Notes For Computer Science 2210 Chapter 1

The document discusses data representation in binary, denary, and hexadecimal number systems. It provides information on converting between these number systems and performing addition on binary numbers. It also covers two's complement representation of negative binary numbers. Various activities with answers are given as examples.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
383 views20 pages

Notes For Computer Science 2210 Chapter 1

The document discusses data representation in binary, denary, and hexadecimal number systems. It provides information on converting between these number systems and performing addition on binary numbers. It also covers two's complement representation of negative binary numbers. Various activities with answers are given as examples.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 20

Islamabad Convent School H8/4 Campus

COMPUTER SCIENCE 2210 O’ LEVELS

Chapter 1: Data Representation

TABLE OF CONTENTS
1.1.2 Binary, denary, and hexadecimal systems..........................................................................2
Converting from binary to denary...............................................................................................................2
ACTIVITY 1.1 (answers)....................................................................................................................2
Converting from denary to binary...............................................................................................................3
ACTIVITY 1.2 (aNSWERS).................................................................................................................4
The hexadecimal system.................................................................................................................................5
Converting from binary to hexadecimal and from hexadecimal to binary................................6
activity 1.3 (answers)........................................................................................................................7
Converting from hexadecimal to binary................................................................................................7
ACTIVITY 1.4(ANSWERS)..................................................................................................................8
Converting from hexadecimal to denary and from denary to hexadecimal..............................8
ACTIVITY 1.5(ANSWERS)..................................................................................................................9
convert from denary to hexadecimal..............................................................................................................9
ACTIVITY 1.6(ANSWERS)................................................................................................................10
1.1.4 Addition of binary numbers......................................................................................................10
ACTIVITY 1.8(aNSWERS).................................................................................................................11
ACTIVITY 1.9(Answers)...................................................................................................................12
ACTIVITY 1.10(ANSWERS)...............................................................................................................13
Activity 1.11(answers).....................................................................................................................13
1.1.6 Two’s complement (binary numbers)........................................................................................14
Activity 1.12 (Answers).......................................................................................................................................14
ACTIVITY 1.13(aNSWERS)..........................................................................................................15
ACTIVITY 1.14(ANSWERS)...............................................................................................................15
ACTIVITY 1.5 (ANSWERS)...............................................................................................................16
ACTIVITY 1.16(ANSWERS)...............................................................................................................16

1
1.1.2 BINARY, DENARY, AND HEXADECIMAL SYSTEMS

CONVERTING FROM BINARY TO DENARY

ACTIVITY 1.1 (ANSWERS)

a. 51

2
b. 127

c. 153

d. 116

e. 255

f. 15

g. 143

h. 179

i. 112

j. 238

k. 487

l. 1364

m. 3855

n. 1992

o. 2047

p. 31984

q. 16141

r. 49983

s. 34952

t. 32767

CONVERTING FROM DENARY TO BINARY

3
ACTIVITY 1.2 (ANSWERS)

Convert the following denary numbers into binary (using both methods):

a. 00101001

b. 01000011

c. 01010110

d. 01100100

e. 01101111

f. 01111111

4
g. 10010000

h. 10111101

i. 11001000

j. 11111111

k. 1000000011101000

l. 0000001101111000

m. 0000111111111111

n. 0100000000010000

o. 1111001101100011

THE HEXADECIMAL SYSTEM

It is a system based on 16 different digits, the numbers 0 to 9 and the letters A to F are
used to represent each hexadecimal (hex) digit.

A in hex = 10 in denary,

B = 11,

C = 12,

D = 13,

E = 14 and

F = 15

Using the same method as for denary and binary, this gives the headings 16 0, 161 ,
162 , 163, and so on. The typical headings for a hexadecimal number with five digits
would be:

5
CONVERTING FROM BINARY TO HEXADECIMAL AND FROM
HEXADECIMAL TO BINARY

6
ACTIVITY 1.3 (ANSWERS)

a. C3

b. F7

c. 27F

d. 4EE

e. 1E1

f. 89E

g. (0)4FE

h. (0)E9C

i. FF7D

j. 67AE

CONVERTING FROM HEXADECIMAL TO BINARY

ACTIVITY 1.4(ANSWERS)

a. 0110 1100

b. 0101 1001

c. 1010 1010

7
d. 1010 0000 0000

e. 0100 0000 1110

f. 1011 1010 0110

g. 1001 1100 1100

h. 0100 0000 1010 1010

i. 1101 1010 0100 0111

j. 0001 1010 1011 0000

CONVERTING FROM HEXADECIMAL TO DENARY AND FROM DENARY


TO HEXADECIMAL

ACTIVITY 1.5(ANSWERS)

a. 107

b. 156

c. 74

d. 255

e. 511

f. 2561

8
g. 2996

h. 3240

i. 4782

j. 44425

CONVERT FROM DENARY TO HEXADECIMAL

ACTIVITY 1.6(ANSWERS)

a. 62

b. E3

c. 1EA

d. 1FF

e. 33A

f. 3E8

g. A4A

h. E9F

9
i. FA7

j. 1388

1.1.4 ADDITION OF BINARY NUMBERS


Note the following key facts when carrying out addition of two binary digits:

ACTIVITY 1.8(ANSWERS)
Carry out the following binary additions:

a.10000011

b. 01100110

10
c.01111011

d .10110110

e. 01101111

f. 10110111

g. 01111110

h. 01110000

i. 11111110

j. 11011101

ACTIVITY 1.9(ANSWERS)

Convert the following denary numbers into binary and then carry out the
binary addition of the two numbers and check your answer against the
equivalent denary sum:

a. 98 = 01100010 and 15 = 00001111; sum = 01110001 (= 113)

b. 29 = 00011101 and 88 = 01011000; sum = 01110101 (= 117)

c. 49 = 00110001 and 100 = 01100100; sum = 10010101 (= 149)

d. 51 = 00110011 and 171 = 10101011; sum = 11011110 (= 222)

e .82 = 01010010 and 69 = 01000101; sum = 10010111 (= 151)

f .100 = 01100100 and 140 = 10001100; sum = 11110000 (= 240)

g .19 = 00010011 and 139 = 10001011; sum = 10011110 (= 158)

h .203 = 11001011 and 30 = 00011110; sum = 11101001 (= 233)

i .66 = 01000010 and 166 = 10100110; sum = 11101000 (= 232)

j. 211 = 11010011 and 35 = 00100011; sum = 11110110 (= 246)

OVERFLOW

11
The generation of a 9th bit is a clear indication that the sum has exceeded this value.
This is known as an overflow error and in this case is an indication that a number is too
big to be stored in the computer using 8 bits.

ACTIVITY 1.10(ANSWERS)
Q1. Convert the following pairs of denary numbers to 8-bit binary numbers and then
add the binary numbers. Comment on your answers in each case:

a. 89 = 01011001 and 175 = 10101111; sum = 1 00001000 (= 8)

overflow error has occurred (9 bits)

b. 168 = 10101000 and 99 = 01100011; sum = 1 00001011 (= 11)

overflow error has occurred (9 bits)

c. 88 = 01011000 and 215 = 11010111; sum = 1 00101111 (= 47)

overflow error has occurred (9 bits)

Q2. Carry out the following 16-bit binary additions and comment on your
answers:

a. 1101 1111 0010 1010 – result is correct

b. 1 1110 1011 1110 0100 – overflow error has occurred

ACTIVITY 1.11(ANSWERS)

Q1.a.denary value = 64 + 32 + 8 = 104 0 0 0 0 1 1 0 1

12
b. denary value is 13 (104 ÷ 8) therefore shift three places right is the same as division
by 23 (i.e. 8)

c .denary value = 15 1 1 1 1 0 0 0 0 d denary value is 240 (15 × 16) therefore shift


four places left is the same as multiplication by 24 (i.e. 16)

Q2 a. 29 = 00011101 and 51 = 00110011

b .sum = 01010000

c. 00001010

d .75 = 01001011

e. 01010101

f .10101010

1.1.6 TWO’S COMPLEMENT (BINARY NUMBERS)

ACTIVITY 1.12 (ANSWERS)


Q1 a. 00100111

b. 01000010

c. 01011000

d.01100110

e.01101111

f .01111101

g. 01001101

h. 00010100

i. 00110001

j. 00111000

Q2. A. 85

b. 51

13
c. 76

d. 126

e. 15

f .125

g. 65

h. 30

i. 113

j. 120

ACTIVITY 1.13(ANSWERS)
Convert the following negative denary numbers into binary numbers using
the two’s complement format:

a .11101110

b. 11100001

c. 11010001

d. 11000001

e. 10101000

f. 10100100

g. 10011100

h. 11111111

i. 11110000

j. 10000001

ACTIVITY 1.14(ANSWERS)
a .−51

b. −66

c .−17
14
d. −121

e. −96

f. −7

g. −81

h. −1

i. −127

j. −10

ACTIVITY 1.5 (ANSWERS)


Q 1. i. The number of possible colours of a group of pixels (usually three or four) based
on the bit depth.

ii .The coding system for all the characters on a standard keyboard and control codes;
extended ASCII, gives another 128 codes to allow for characters in non-English
alphabets and for some graphical characters to be included.

iii. The coding system which represents all the languages of the world (the first 128
characters are the same as ASCII code).

iv .The number of sound samples taken per second.

v. Images which are made up of pixels.

Q. 2 i, ii, iii each colour is 28 = 256

iv 256 × 256 × 256 = 16 777 216 possible colours 3 They both increase the size of the
sound file.

ACTIVITY 1.16(ANSWERS)

15
ANSWERS TO EXAM-STYLE QUESTIONS
ANSWERS TO QUESTIONS 6 AND 7 IN THIS SECTION ARE EXAMPLE ANSWERS FOR PAST PAPER
QUESTIONS. THE DETAILS OF THE RELEVANT PAST PAPER CAN BE FOUND WITH THE
CORRESPONDING EXAM-STYLE QUESTION IN THE STUDENT’S BOOK.

16
17
18
19
20

You might also like