Cs Chapter 1
Cs Chapter 1
Page 1 of 31
© 2015-2024 Save My Exams, Ltd. · Revision Notes, Topic Questions, Past Papers
Head to www.savemyexams.com for more awesome resources
Page 2 of 31
© 2015-2024 Save My Exams, Ltd. · Revision Notes, Topic Questions, Past Papers
Head to www.savemyexams.com for more awesome resources
Worked Example
Explain why computers process data in binary format [2]
Answer
Computers process data using logic gates... [1]
... that can only have two states (1/0) [1]
Page 3 of 31
© 2015-2024 Save My Exams, Ltd. · Revision Notes, Topic Questions, Past Papers
Head to www.savemyexams.com for more awesome resources
Number Systems
Your notes
The Denary, Binary & Hexadecimal Number Systems
What is denary?
Denary is a number system that is made up of 10 digits (0-9)
Denary is referred to as a base-10 number system
Each digit has a weight factor of 10 raised to a power, the rightmost digit is 1s (100), the next digit to the
left 10s (101) and so on
Humans use the denary system for counting, measuring and performing maths calculations
Using combinations of the 10 digits we can represent any number
What is binary?
Binary is a number system that is made up of two digits (1 and 0)
Binary is referred to as a base-2 number system
Each digit has a weight factor of 2 raised to a power, the rightmost digit is 1s (20), the next digit to the
left 2s (21) and so on
Each time a new digit is added, the column value is multiplied by 2
Using combinations of the 2 digits we can represent any number
Page 4 of 31
© 2015-2024 Save My Exams, Ltd. · Revision Notes, Topic Questions, Past Papers
Head to www.savemyexams.com for more awesome resources
Your notes
What is hexadecimal?
Hexadecimal is a number system that is made up of 16 digits, 10 numbers (0-9) and 6 letters (A-F)
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
0 1 2 3 4 5 6 7 8 9 A B C D E F
Page 5 of 31
© 2015-2024 Save My Exams, Ltd. · Revision Notes, Topic Questions, Past Papers
Head to www.savemyexams.com for more awesome resources
16s 1s
Your notes
1 3
1 x16 3x1 = 19
A quick comparison table demonstrates a relationship between hexadecimal and a binary nibble
One hexadecimal digit can represent four bits of binary data
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
Page 6 of 31
© 2015-2024 Save My Exams, Ltd. · Revision Notes, Topic Questions, Past Papers
Head to www.savemyexams.com for more awesome resources
13 1101 D
Your notes
14 1110 E
15 1111 F
Page 7 of 31
© 2015-2024 Save My Exams, Ltd. · Revision Notes, Topic Questions, Past Papers
Head to www.savemyexams.com for more awesome resources
Example 1
To convert the denary number 45 to binary, start by writing out the binary number line
The first column heading larger than 45 is 64, so the number line would be:
32 16 8 4 2 1
13
32 16 8 4 2 1
Repeat with next column heading (how many times does 16 fit into 13?)
0 times with 13 remaining
Page 8 of 31
© 2015-2024 Save My Exams, Ltd. · Revision Notes, Topic Questions, Past Papers
Head to www.savemyexams.com for more awesome resources
13 13
Your notes
32 16 8 4 2 1
1 0
13 13 5 1 1 0
32 16 8 4 2 1
1 0 1 1 0 1
Example 2
To convert the denary number 3059 to binary, start by writing out the binary number line
The first column heading larger than 3059 is 4096, so the number line would be:
Page 9 of 31
© 2015-2024 Save My Exams, Ltd. · Revision Notes, Topic Questions, Past Papers
Head to www.savemyexams.com for more awesome resources
1011
Your notes
2,048 1,024 512 256 128 64 32 16 8 4 2 1
Repeat with next column heading (how many times does 1024 fit into 1011?)
0 times with 1011 remaining
1011 1011
1 0
1 0 1 1 1 1 1 1 0 0 1 1
Example 1 (4 bits)
To convert the binary number 1011 to denary, start by writing out the binary headings from right to left
8 4 2 1
Page 10 of 31
© 2015-2024 Save My Exams, Ltd. · Revision Notes, Topic Questions, Past Papers
Head to www.savemyexams.com for more awesome resources
Your notes
Write in the binary digits under the headings from left to right
8 4 2 1
1 0 1 1
Example 2 (8 bits)
To convert the binary number 01100011 to denary, start by writing out the binary headings from right to
left
128 64 32 16 8 4 2 1
Write in the binary digits under the headings from left to right
128 64 32 16 8 4 2 1
0 1 1 0 0 0 1 1
Page 11 of 31
© 2015-2024 Save My Exams, Ltd. · Revision Notes, Topic Questions, Past Papers
Head to www.savemyexams.com for more awesome resources
0 1 1 1 0 0 0 1 1 1 0 1 0 0
Page 12 of 31
© 2015-2024 Save My Exams, Ltd. · Revision Notes, Topic Questions, Past Papers
Head to www.savemyexams.com for more awesome resources
128 64 32 16 8 4 2 1
0 0 0 1 1 1 0 0
Split the 8 bit binary number into two nibbles as shown below
8 4 2 1 8 4 2 1
0 0 0 1 1 1 0 0
Page 13 of 31
© 2015-2024 Save My Exams, Ltd. · Revision Notes, Topic Questions, Past Papers
Head to www.savemyexams.com for more awesome resources
B (11) 9
8 4 2 1 8 4 2 1
1 0 1 1 1 0 0 1
128 64 32 16 8 4 2 1
1 0 1 1 1 0 0 1
Page 14 of 31
© 2015-2024 Save My Exams, Ltd. · Revision Notes, Topic Questions, Past Papers
Head to www.savemyexams.com for more awesome resources
Remember that the exam is non-calculator, if you are not confident multiplying and dividing by 16
then use method 1 on both conversions
Your notes
Page 15 of 31
© 2015-2024 Save My Exams, Ltd. · Revision Notes, Topic Questions, Past Papers
Head to www.savemyexams.com for more awesome resources
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
0 1 2 3 4 5 6 7 8 9 A B C D E F
Example 1
To convert the binary number 10110111 to hexadecimal, first split the 8 bit number into 2 binary nibbles
8 4 2 1 8 4 2 1
1 0 1 1 0 1 1 1
Example 2
To convert the binary number 00111001 to hexadecimal, first split the 8 bit number into 2 binary nibbles
8 4 2 1 8 4 2 1
0 0 1 1 1 0 0 1
Page 16 of 31
© 2015-2024 Save My Exams, Ltd. · Revision Notes, Topic Questions, Past Papers
Head to www.savemyexams.com for more awesome resources
(1 x 8) + (1 x 1) = 9
Join them together to make a 2 digit hexadecimal number Your notes
Binary 00111001 is 39 in hexadecimal
Hexadecimal to Binary Conversion
How do you convert from hexadecimal to binary?
Example 1
To convert the hexadecimal number 5F to binary, first split the digits apart and convert each to a binary
nibble
8 4 2 1
0 1 0 1 =5
8 4 2 1
1 1 1 1 = 15 (F)
128 64 32 16 8 4 2 1
0 1 0 1 1 1 1 1
Example 2
To convert the hexadecimal number 26 to binary, first split the digits apart and convert each to a binary
nibble
8 4 2 1
0 0 1 0 =2
Page 17 of 31
© 2015-2024 Save My Exams, Ltd. · Revision Notes, Topic Questions, Past Papers
Head to www.savemyexams.com for more awesome resources
8 4 2 1
Your notes
0 1 1 0 =6
128 64 32 16 8 4 2 1
0 0 1 0 0 1 1 0
Page 18 of 31
© 2015-2024 Save My Exams, Ltd. · Revision Notes, Topic Questions, Past Papers
Head to www.savemyexams.com for more awesome resources
Uses of Hexadecimal
Your notes
Uses of Hexadecimal
Why is hexadecimal used?
In Computer Science hexadecimal is often preferred when working with large values
It takes fewer digits to represent a given value in hexadecimal than in binary
1 hexadecimal digit corresponds 4 bits (one nibble) and can represent 16 unique values (0-F)
It is beneficial to use hexadecimal over binary because:
The more bits there are in a binary number, the harder it makes for a human to read
Numbers with more bits are more prone to errors when being copied
Examples of where hexadecimal can be seen:
MAC addresses
Colour codes
URLs
MAC addresses
A typical MAC address consists of 12 hexadecimal digits, equivalent to 48 digits in in binary
AA:BB:CC:DD:EE:FF
10101010:10111011:11001100:11011101:11101110:11111111
Writing down or performing calculations with 48 binary digits makes it very easy to make a mistake
Page 19 of 31
© 2015-2024 Save My Exams, Ltd. · Revision Notes, Topic Questions, Past Papers
Head to www.savemyexams.com for more awesome resources
Colour codes
A typical hexadecimal colour code consists of 6 hexadecimal digits, equivalent to 24 digits in binary Your notes
#66FF33 (green)
01000010:11111111:00110011
URL's
A URL can only contain standard characters (a-z and A-Z), numbers (0-9) and some special symbols
which is enough for basic web browsing
Page 20 of 31
© 2015-2024 Save My Exams, Ltd. · Revision Notes, Topic Questions, Past Papers
Head to www.savemyexams.com for more awesome resources
If a URL needs to include a character outside of this set, they are converted into a hexadecimal code
Hexadecimal codes included in a URL are prefixed with a % sign Your notes
Page 21 of 31
© 2015-2024 Save My Exams, Ltd. · Revision Notes, Topic Questions, Past Papers
Head to www.savemyexams.com for more awesome resources
Binary Addition
Your notes
Adding Positive 8-bit Binary Integers
What is binary addition?
Binary addition is the process of adding together two binary integers (up to and including 8 bits)
To be successful there are 5 golden rules to apply:
0+0= 0 1s
0 =0
0+1= 1 1s
1 =1
1+0= 1 1s
1 =1
1+1= 10 2s 1s
1 0 =2
1+1+1= 11 2s 1s
1 1 =3
Page 22 of 31
© 2015-2024 Save My Exams, Ltd. · Revision Notes, Topic Questions, Past Papers
Head to www.savemyexams.com for more awesome resources
Like denary addition, start from the rightmost digit and move left
Carrying over occurs when the sum of a column is greater than 1, passing the excess to the next left Your notes
column
Example 1
Add together the binary values 1001 and 0100
8 4 2 1 +
1 0 0 1
0 1 0 0
Starting from right to left, add the two binary values together applying the 5 golden rules
If your answer has 2 digits, place the rightmost digit in the column and carry the remaining digit to the
next column on the left
In this example, start with 1+0, 1+0 = 1, so place a 1 in the column
8 4 2 1 +
1 0 0 1
0 1 0 0
8 4 2 1 +
Page 23 of 31
© 2015-2024 Save My Exams, Ltd. · Revision Notes, Topic Questions, Past Papers
Head to www.savemyexams.com for more awesome resources
1 0 0 1
Your notes
0 1 0 0
1 1 0 1
The sum of adding together binary 1001 (9) and 0100 (4) is 1101 (13)
Example 2
Add together the binary values 00011001 and 10000100
128 64 32 16 8 4 2 1 +
0 0 0 1 1 0 0 1
1 0 0 0 1 0 0 1
Starting from right to left, add the two binary values together applying the 5 golden rules
If your answer has 2 digits, place the rightmost digit in the column and carry the remaining digit to the
next column on the left
In this example, start with 1+1, 1+1 = 10, so place a 0 in the column and carry the 1 to the next column
128 64 32 16 8 4 2 1 +
Page 24 of 31
© 2015-2024 Save My Exams, Ltd. · Revision Notes, Topic Questions, Past Papers
Head to www.savemyexams.com for more awesome resources
0 0 0 1 1 0 0 1
Your notes
1 0 0 0 1 0 0 1
1 C
128 64 32 16 8 4 2 1 +
0 0 0 1 1 0 0 1
1 0 0 0 1 0 0 1
1 1 1 C
1 0 1 0 0 0 1 0
The sum of adding together binary 00011001 (25) and 10001001 (137) is 10100010 (162)
256 128 64 32 16 8 4 2 1 +
1 1 1 1 1 1 1 1
0 0 0 0 0 0 0 1
1 1 1 1 1 1 1 1 C
Page 25 of 31
© 2015-2024 Save My Exams, Ltd. · Revision Notes, Topic Questions, Past Papers
Head to www.savemyexams.com for more awesome resources
0 0 0 0 0 0 0 0
Your notes
Page 26 of 31
© 2015-2024 Save My Exams, Ltd. · Revision Notes, Topic Questions, Past Papers
Head to www.savemyexams.com for more awesome resources
Binary Shifts
Your notes
Binary Shifts
What is a logical binary shift?
A logical binary shift is how a computer system performs basic multiplication and division on non-
negative values (0 and positive numbers)
Binary digits are moved left or right a set number of times
A left shift multiplies a binary number by 2 (x2)
A right shift divides a binary number by 2 (/2)
A shift can move more than one place at a time, the principle remains the same
A left shift of 2 places would multiply the original binary number by 4 (x4)
128 64 32 16 8 4 2 1
0 0 1 0 1 0 0 0
To perform a left logical binary shift of 1, we move each bit 1 place to the left
The digit in the 128 column (MSB) will move left causing an overflow error
The 1 column becomes empty so is filled with a 0
128 64 32 16 8 4 2 1
0 1 0 1 0 0 0 = 40
0 1 0 1 0 0 0 0 = 80
The original binary representation of denary 40 (32+8) was multiplied by 2 and became 80 (64+16)
0 0 0 1 1 1 0 0
To perform a left binary shift of 2, we move each bit 2 places to the left
The digit in the 128 (MSB) and 64 column will move left causing an overflow error
The 1 and 2 column become empty so are filled with a 0
128 64 32 16 8 4 2 1
0 1 1 1 0 0 = 28
0 1 1 1 0 0 0 0 = 112
The original binary representation of denary 28 (16+8+4) was multiplied by 4 and became 112
(64+32+16)
128 64 32 16 8 4 2 1
0 0 1 0 1 0 0 0
To perform a right binary shift of 1, we move each bit 1 place to the right
The digit in the 1 column (LSB) will move right causing an underflow error
The 128 column becomes empty so is filled with a 0
128 64 32 16 8 4 2 1
0 0 1 0 1 0 0 = 40
0 0 0 1 0 1 0 0 = 20
Page 28 of 31
© 2015-2024 Save My Exams, Ltd. · Revision Notes, Topic Questions, Past Papers
Head to www.savemyexams.com for more awesome resources
The original binary representation of denary 40 (32+8) was divided by 2 and became 20 (16+4)
128 64 32 16 8 4 2 1
1 1 0 0 1 0 0 0
To perform a right binary shift of 2, we move each bit 2 places to the right
The digits in the 1 (LSB) and 2 columns will move right causing an underflow error
The 128 and 64 columns become empty so are filled with a 0
128 64 32 16 8 4 2 1
1 1 0 0 1 0 = 200
0 0 1 1 0 0 1 0 = 50
The original binary representation of denary 200 (128+64+8) was divided by 4 and became 50
(32+16+2)
Page 29 of 31
© 2015-2024 Save My Exams, Ltd. · Revision Notes, Topic Questions, Past Papers
Head to www.savemyexams.com for more awesome resources
Two's Complement
Your notes
Two's Complement
What is two's complement?
Two's complement is a method of using signed binary values to represent negative numbers
Using two's complement the left most bit is designated the most significant bit (MSB)
To represent negative numbers this bit must equal 1, turning the column value in to a negative
Working with 8 bits, the 128 column becomes -128
-128 64 32 16 8 4 2 1
1 1 1 1 1 1 1 1 = -1
In the example above to represent -1, add column values with a 1 to the MSB
MSB (-128)
Add 64 (-128+64 = -64
Add 32 (-64+32 = -32)
Add 16 (-32+16 = -16)
Add 8 (-16+8 = -8)
Add 4 (-8+4 = -4)
Add 2 (-4+2 = -2)
Add 1 (-2+1 = -1)
The two's complement representation of -1 is 11111111
128 64 32 16 8 4 2 1
Page 30 of 31
© 2015-2024 Save My Exams, Ltd. · Revision Notes, Topic Questions, Past Papers
Head to www.savemyexams.com for more awesome resources
0 1 0 0 1 1 0 0 = 76
Your notes
Starting from the least significant bit (right most column), copy out the binary values up to and
including the first 1
-128 64 32 16 8 4 2 1
1 0 0
-128 64 32 16 8 4 2 1
1 0 1 1 0 1 0 0
-128 + 32 + 16 + 4 = -76
The two's complement representation of -76 is 10110100
Page 31 of 31
© 2015-2024 Save My Exams, Ltd. · Revision Notes, Topic Questions, Past Papers