…to GCSE Level with Python Sue Sentance Sue.sentance@anglia.ac.uk Teaching Computing… …to GCSE Level with Python Sue Sentance Sue.sentance@anglia.ac.uk
Course overview Week No Date Computing Theory (5:30 – 6:30) Programming in Python (6:30 – 8:00) 1 15/01/2013 Structure of the course Introduction to Binary Variables/assignment 2 22/01/2013 More binary logic/hex Selection 3 29/01/2013 Truth tables/logic diagrams Iteration 4 05/02/2013 Structure of the processor Iteration/Lists 5 12/02/2013 (start 6pm) Algorithms and Dry Runs More on lists 6 26/02/2013 The internet Functions 7 05/03/2013 Networking/ HTML and CSS Files 8 12/03/2013 Database theory Databases 9 19/03/2013 GCSE Controlled Assessment Tasks 10 26/03/2013 Consolidation
Available specifications for 2012-2013 OCR – will be in third year EdExcel – now delayed until September 2013 AQA – up and running from September 2012 Behind the Screen – E-Skills work-in-progress to create a GCSE in Computer Science
OCR GCSE Computing 3 units A451 – Theory (Examination) A452 – Practical investigation (Controlled Assessment) A453 – Programming (Controlled Assignment)
AQA Computer Science Component 1 – Practical programming 50 hours controlled assessment Worth 60% Component 2 – Computing fundamentals 1 ½ hour examination Worth 40%
Today’s session 4:45 – 5:45 Binary & Binary arithmetic/ Hex 6.00 – 7.30 Starting to program in Python
From the specification OCR (a) define the terms bit, nibble, byte, kilobyte, megabyte, gigabyte, terabyte (b) understand that data needs to be converted into a binary format to be pro (c) convert positive denary whole numbers (0-255) into 8-bit binary numbers and vice versa (d) add two 8-bit binary integers and explain overflow errors which may occur (e) convert positive denary whole numbers (0-255) into 2-digit hexadecim AQA understand that computers use the binary alphabet to represent all data and instructions understand the terms bit, nibble, byte, kilobyte, megabyte gigabyte and terabyte understand that a binary code could represent different types of data such as text, image, sound, integer, date, real number understand how binary can be used to represent positive whole numbers (up to 255) understand how sound and bitmap images can be represented in binary understand how characters are represented in binary and be familiar with ASCII and its limitations understand why hexadecimal number representation is often used and know how to convert between binary, denary and hexadecimal
Binary numbers
Binary numbers 1
Learning binary numbers Converting binary to denary Converting denary to binary Binary addition
Storing Binary Numbers Inside the computer each binary digit is stored in a unit called a bit. A series of 8 bits is called a byte. A bit can take the values 0 and 1
What is meant by? 1 byte ? 1 nibble ? 1 kilobyte ? 1 megabyte ? 1 gigabyte ? 1 terabyte ?
Storing data 1 byte 1 nibble 1 kilobyte 1 megabyte 1 gigabyte 1 terabyte 1 byte = 8 bits 1 nibble = 4 bits 1 kilobyte = 1024 bytes = 2 10 bytes 1 megabyte = 2 20 bytes = 210 kilobytes 1 gigabyte = 2 30 bytes = 210 megabytes 1 terabyte = 2 40 bytes = 2 10 gigabytes
Activity Binary counting exercise
How to convert Binary Numbers to denary Place values 1 2 128 64 32 16 8 4 128+0+0+16+8+ 0+ 2 +1 = 155 in Denary
Storing Numbers - Binary EXAMPLE Convert the binary number 1011 0111 into denary: Answer 128 64 32 16 8 4 2 1 1 0 1 1 0 1 1 1 =128+32+16+4+2+1=183
Conversion Exercise Convert the following binary numbers into denary: 0 0 1 0 1 0 1 0 0 0 1 0 0 1 1 0 1 1 1 0 1 0 1 0 1 1 1 1 1 1 0 0 1 0 1 0 1 1 0 1 1 1 1 1 1 1 1
Teaching binary Holding cards up activity Finger binary Cisco binary game CS Unplugged actitivies
Converting Denary to Binary Write down the column headings for the binary number: 64 32 16 8 4 2 1 Process each column from left to right. If the denary number to be translated is greater than or equal to the column heading, place a 1 in the column and subtract the value of the column from the denary value. If the denary value is smaller than the column heading, place a 0 in the column.
Convert to Binary 3 5 8 7 11 16 32 21 14 17 48 255
Sizes of Binary Numbers If we have 4 bits available the largest number is 1 1 1 1 (which is 15 in denary) If we have 5 bits available the largest number is 1 1 1 1 1 (denary value 31) If we have 7 bits available the largest number is 1 1 1 1 1 1 1 (denary value 127) If we have 8 bits available the largest number is 1 1 1 1 1 1 1 1 (denary value 255) Can you see a pattern? animated
To calculate the max size In general if we have n bits available then the largest denary number we can store is 2n - 1 For example, for 3 bits, 1112 = 23 – 1 = 8 – 1 = 7
Addition Rules for Binary 0 + 0 = 0 1 + 0 = 1 0 + 1 = 1 1 + 1 = 10 (write down 0 and carry 1) 1 + 1 + 1 = 11 (write down 1 and carry 1)
check the answer using place values: 8+4+0+1 = 13 Adding Binary Numbers add 8 and 5 8 1 0 0 0 5 0 1 0 1 ---------------- 13 1 1 1 check the answer using place values: 8+4+0+1 = 13
check the answer using place values: 8+4+2+0 = 14 Adding Binary Numbers add 9 and 5 9 1 0 0 1 5 0 1 0 1 ---------------- 1 carry 14 1 1 1 check the answer using place values: 8+4+2+0 = 14
Exercises – see sheet