Professional Documents
Culture Documents
Computer Science Full GCSE Notes
Computer Science Full GCSE Notes
CORE NOTES
Topic 1:
Decomposition:
o Breaking down a problem into smaller problems
o ... which are easier to solve (or can be broken down further)
o e.g getting ready in the morning --> clean myself, dress myself, feed myself, get into
the car
Abstraction:
o Removing unnecessary detail [for representing]
o To focus on the important aspects
o e.g. pack of cards on computer: focus on suite and number instead of physical card
dimensions/colours etc.
Benefits of subprograms
o Decomposition:
o Used to break down a complex program down to make it easier to program
o Reduces duplicate code
o Allows for easy reuse of code across more than one program
o Allows different parts of a large program to be worked on by any different
programmers at the same time
o Speeds up program development
o Makes code easier to maintain/debug/fix.
Flowcharts:
o Start/stop oval symbols
o Parallelogram is input or output
o Diamond is decision (choice) and be labelled yes/no
o Rectangle is an action (e.g increase x by 4)
o Rectangle with extra side-lines is subprogram (which is pre-assigned, it calls it and
then continues)
o Every line must have arrows
Flowchart/pseudocode algorithms:
o algorithm: a sequence of steps to solve a problem/task
o input-process-output
o sequence (ordering of code one line after the other), selection (choosing what code
to do next), repetition (count-controlled or condition controlled repeating of code),
iteration (processing every item in a data structure)
o The flowchart problem will probably iterate over a data structure e.g. Name[count]
to get each letter in a string or MyNames[count] to get each name in a list
o Constants - values don't change at runtime unlike variables
o The three data structures are strings (list of characters), records (2D with different
data types) and arrays (2D with same data types)
[records & arrays are both implemented as lists in python]
o Arrays have one data type, Record have more than one
Trace tables:
o have one column for each variable and for output usually
o usually don’t fill in / repeat cells if not assigned
o Remember to fill-in the initial values given in the code
Linear Search:
o E.g compare looking for 3 in a list of [1,2,4,5]
o Compares 3 with 1 [>]
o Compares 3 with 2 [>]
o Compares 3 with 4 [<]
o Realises that 4 has passed the target so for efficiency quits (ONLY if we know list
is ordered)
Binary Search:
o E.g. compare looking for 1 in a list of [1,2,3,4,5,6,7]
o Compares 1 with 4 (the median) [<]
o Compares 1 with 2 (median of 1,2,3) [<]
o 1 is found
Bubble Sort
o List: [13,5,10,50,4,6,20,9]
FIRST PASS
o Compares 13 with 5. Swap. 5,13,10,50,4,6,20,9
o Compares 13 with 10. Swap. 5,10,13,50,4,6,20,9
o Compares 13 with 50.
o Compares 50 with 4. Swap. 5,10,13,4,50,6,20,9
o Compares 50 with 6. Swap. 5,10,13,4,6,50,20,9
o Compares 50 with 20. Swap. 5,10,13,4,6,20,50,9
o Compares 50 with 9. Swap. 5,10,13,4,6,20,9,50
Merge Sort:
o List: [13,5,10,50,4,6,20,9]
o Split into halves. If odd, the half with 1 fewer item on the left.
13, 5, 10, 50 4, 6, 20, 9
o Split into halves again.
13, 5 10, 50 4,6 20,9
o Split until items are individualised.
13 5 10 50 4 6 20 9
o Merge items, sorting each time item are merged
5,13 10,50 4,6 9,20
o Merge again.
5,10,13,50 4,6,9,20
o Merge again (first items of the two sublists are repeatedly compared then
appended, being removed from the sublist each time).
4,5,6,9,10,13,20,50
To make an algorithm more efficient:
o reduce number of comparisons (e.g. quit a linear search if data is ordered and found
a larger value than target value)
o reduce number of passes (quit bubble sort early if a complete pass makes no
changes)
o reduce use of memory (e.g. merge sort although quicker - time efficient - is less
memory efficient because it uses more ram than bubble sort by splitting into new
lists)
Errors:
o syntax: errors in use of the programming language, such as missing ':', misspelled
keywords, and missing or excessive indentation
o runtime: errors which cause a program to crash, such as 'divide by zero' and 'index
out of range'
o logical: errors which cause incorrect or unwanted behaviours, such as using the
wrong arithmetic operator or mixing up two variable names
Trace tables:
o e.g. trace the following
total = 0
for ch in "24576":
num = int(ch)
total += num
print(total)
ch num total output
0
"2" 2 2
"4" 4 6
"5" 5 11
"7" 7 18
"6" 6 24 24
Truth Tables:
o Complete a truth table for X = NOT A OR NOT(B AND C)
A B C NOT A B AND C NOT(B AND C) X
0 0 0 1 0 1 1
0 0 1 1 0 1 1
0 1 0 1 0 1 1
0 1 1 1 1 0 1
1 0 0 0 0 1 1
1 0 1 0 0 1 1
1 1 0 0 0 1 1
1 1 1 0 1 0 0
Topic 2:
Use of Binary:
o all data in a computer is represented in binary (sound/images/program instructions)
o because computers made from transistors which are in one of two states on/off (1
or 0)
o 8 bits have 2^8 = 256 possibilities (0 to 255) but 4 bit have only 2 ^ 4 = 16
possibilities (0-15)
Two’s Complement:
o In unsigned 8-bit binary (0 to 255), most significant bit in a byte is worth 128
o In signed 8-bit binary (-128 to 127), the most significant bit in a byte is worth -128
Conversions:
o Convert 207 to 8-bit binary
128 64 32 16 8 4 2 1
1 1 0 0 1 1 1 1
o Always 8-bit for GCSE, remember to add left zeroes if needed
o To negate a number in two's complement form :
flip all the bits and then add one
(or from the right, retain all the bits up to & inc the first 1 then flip the rest)
e.g. 0010 1100 --> 1101 0100
7 Bit Ascii:
o Characters = 2^7 = 128
o Can’t store different languages
o Limited symbols
Data storage:
o bit (b) is smallest binary unit, 0 or 1
o nibble is 4 bits, 1 hex digit e.g 1111
o Byte(B) is 8 bits, 1111 1111
o Kibibyte(kiB) is 1024 bytes
o Mebibyte (MiB) is another 1024*1024 bytes
o With storage we always use binary units & bytes
(different for data transmission see below)
Storage Calculations:
o e.g. 2048 by 800 pixels, 24 colour depth in mebibytes: always give expressions
o (2048x800x24)
-------------------
(8x1024x1024)
Data compression:
o Definition: Algorithm to reduce file or transmission size
o Purpose: Reduces storage on device, saves data transmission amount (so less costs
and less buffer in streaming)
o Example of utility software [software installed on OS to help it run smoothly]
o Lossy:
Permanently removes unnecessary detail that humans can’t easily notice
Cannot be restored
Reduces quality
Achieves smaller file size
o Lossless:
Original file can be fully restored
Same quality as original (have to uncompress before looking at)
Two ways of doing it: Run Length Encoding [RLE] e.g BBBB = Bx5, has to for
consecutive runs
OR Dictionary Encoding [DE] Replace repeated patterns with an index number
e.g replace word rabbit with 1, at start: have dictionary
Topic 3:
Embedded systems:
o Small computer which is part of a wider machine
o ONE specific function, not general purpose
o Have input/sensor, process the input, output [motor]
e.g. washing machines, automated headlights and windscreen wipers
o characteristics: cheap/physically small on one board (microcontroller)/ limited
memory / limited processing speed / limited user interface/ programmed with very
simple & reliable robust single program.
Robust software:
o Software which if experiencing an unexpected input/event ...
o ...doesn’t crash, give out an incorrect result or reveal secure information
o code reviews
checks of source code by other experienced programmers or by AI review
Helps identify bad programming practice
Check the efficiency & security & robustness of the code
HLL:
o English like words
o 1 line translated into multiple machine code instruction
o Easier to read, write and debug than LLL
o Portable between different computers/CPUs
LLL:
o Machine or Assembly code
o Machine = binary, assembly = mnemonics e.g ADD 2
o One line of LLL = one CPU instruction
o Specific to that one CPU
o Gives complete control of RAM/CPU so likely to be faster
Compiler:
Interpreter:
Topic 4:
Why do we network:
o To share between users/computers:
files,
messages (communication)
and hardware (e.g. printers/internet connections)
LAN :
o Small geographic area
o All equipment owned and configured by one business/person
WAN:
o Wide geographic area (Internet is the biggest example)
o The networking connections between areas are leased / not all owned by the
business
IP Address:
o Uniquely identifies a device whilst connected to the internet
o Four byte format e.g. 217.156.102.84
o Added to each packet (sender IP address & destination IP address)
o ....which are used by routers (checking their routing tables at the network layer) to
direct packets
Wired v Wireless:
o Speed is higher on wired (measured in bps bits per second transferred)
o Latency is higher on wireless (the delay between sending/receiving measured in
seconds)
o Wireless has more interference between competing traffic & also encrypts which
increases latency / reduces speed
protection methods:
o Firewalls:
Checks all packets in and out of the network
Blocks those packets that don’t meet the configured rules
Can help prevent hacking / unauthorised access and also Worms/malware
spreading or employees accessing unsafe/unwanted sites
o Physical security:
CCTV
Security guards
Door locks / Secure access areas/ staff passes / fences
o Access control:
Only someone with a valid username and password can gain access to
device
Network manager might insist on password rules
Authentication is the process of establishing the identify of the user by a log-
on process
Different users can have difference access levels once established
(administrator/user etc)
Topic 5:
o Legal liability:
who is responsible for mistakes (the owner / the manufacturer / insurance
companies?)
o Safety:
does the AI/algorithm pose social risk?
Cybersecurity:
Anti-malware
o Helps keep your computer and files safe from many types of malware
o Virtually all OS come with malware protection prebuilt
Encryption:
o Process of turning plain text into an unreadable form
o Encrypted using an encryption algorithm (a cipher) and a unique key
o Only user with appropriate key will be able to translate the cyphertext back into
readable form.
o Doesn't stop hacking but makes the data unreadable if obtained or intercepted
Exam Technique:
o 75 marks in 90 mins
o Over a min per mark
o 1 question per topic (with different parts)
o Relax at the START in particular and pick your own first question to slowly get into it
o Look at one clear point made per mark in explanations
o Cover yourself with extra points on explain / describe but not on state questions (e.g
don’t give 3 reasons if it asks for 2 but you can still cover yourself with explanation in
brackets e.g. SSDs are more robust (since they have no moving parts).)