You are on page 1of 73

Computer Science Revision

3 hr
Revision Topic Areas
• Block 1 - Programming
• Block 2 - Data Representation
• Block 3 - Compression and Encryption
• Block 4 - Computers and Assembly Language
• Block 5 - Networking and HTML
• Block 6 - Databases and SQL
• Block 7 - Issues and Impact
• Block 8 - Microcontrollers
• Block 9 - Computational Models + Emerging Trends
• Block 10 - Computational Thinking
Block 1

Programming
Programming Elements
• Escape Squence • For loops
• Operators • While loops
• Errors • Functions
• Data types • File IO
• Variables
• Relational operators
• If … then … else
• Arrays
Sequence, selection and iteration
These are the fundamental building blocks of any program
and any true programing language will contain all of these.

1. Sequence – the ORDER in which statements are


executed.
2. Selection – the use of logic to select the statement to
be EXECUTED.
3. Iteration – the use of repetition (to prevent typing the
same code out many times a loop structure is used. For
example While or For).
Pseudo code keywords

• Input: READ; OBTAIN; GET


• Output: PRINT; DISPLAY; SHOW
• Compute: COMPUTE; CALCULATE
• Initialise: SET; INIT;
• Add one: INCREMENT; ADD
Pseudocode
What does this pseudocode do?

RECEIVE myName FROM (STRING) KEYBOARD


RECEIVE myAge FROM (INTEGER) KEYBOARD
SET AgeInTen TOmyAge + 10
SEND myName “will be” AgeInTen “in 10 years’
time” TO DISPLAY
Programming
• State the line number
that shows the
initialisation of a data
structure.
• State the range of line
numbers that show a
repetition.
• There is a bug in line 9.
Write a line of code that
will fix this bug.
Programming - Answers
• State the line number that
shows the initialisation of a
data structure. Line 3
• State the range of line numbers
that show a repetition. Lines 9-
16
• There is a bug in line 9. Write a
line of code that will fix this
bug.
Flowcharts
Flowcharts
• Complete the gaps
Flowcharts
Logic
Remind yourselves of the
truth tables and the types of
logic:
• AND
• OR
• NOT
• NAND
• NOR
• XOR

Most common
Logic Questions
Logic Answer
Validation
presence , range , length , type, look-up
Type of validation Description Example

Length Checks the data entered is not too Password


short or too long.

Presence Checks that data has been entered. Name entry


Range Checks that a the value entered falls Age
within a given range.

Type Checks that the value entered is of Number


the expected type.

Look-up Checks the entered value is a value Password check,


that is expected.
Checks value against a look up list or Name check.
string.
Block 2

Data Represenation
What is a binary number?
• A binary number is made up of just 2 digits
and is known as base 2.
01
• Each position is 2 times more than the other.
1x8
1101 1x4 8 + 4 + 1 = 13
0x2
1x1
18
Adding binary
There are 6 addition questions that you need
to complete. Complete them independently

Where we get 2, we write 0 and carry the 1:

00001011 00010011
+ 00001101 + 00000111
What is Overflow?
If there were only 8 bits to store numbers this
would mean that the 9th bit would be lost. This is
called overflow and this leaves an incorrect
value.
ASCII
What is a Hexadecimal number?
• A hexadecimal number is made up of 16 digits and
is known as base 16.
0123456789ABCDEF
How hexidecimal is laid out
Number system Output (Bytes)
Denary 15
Binary 0000 1111
Hexadecimal 0F

These numbers have been shown in bytes


22
DENARY TO HEXADECIMAL
How would you convert 200 denary to
hexadecimal?
1. Divide 200 by 16 =
2. 12 (lots of 16) remainder 8 (units)
3. 12 as a hex = C and 8 is 8
4. Answer is C8
Hexadecimal to Denary
Convert AC to denary

1. Break apart the hex letters and work out


– A = 10 C = 12
2. Depending on there position, multiply by x1, x16, x32 or relevant
number.
– A = ( 10 X 16) = 160 C = ( 12 X 1 ) = 12
3. Add all of the totals together
– 160 + 12 = 172

A C
AC = (10 X 16) + (12 X 1) = 160 + 12 = 172
Two’s complement
Two’s complement is the method computers use to represent signed
numbers. The most significant bit is the sign bit:

• 0 = positive value
• 1 = negative value.

The negative representation of a number is created as follows:

1. start with the positive number


2. flip the bits (change ‘0’ to ‘1’ and ‘1’ to ‘0’)
3. add the value 1. Because of this a 16-bit signed integer only has 15 bits
for data whereas a 16-bit unsigned integer has all 16 bits available.

Read page 123-124 of the GCSE text book to gain a deeper understanding of
this and overflow within the number systems
The Size of Things
Hard Drive Capacity Comparison But also think about GHZ Giga
1 Kilobyte (KB) A kilobyte is 1024 Bytes Hertz for clock speed, think CPU
1 Megabyte (MB) A Megabyte is 1 048 576 processing speed!
Bytes or easier to remember
as 1024 Kilobytes.
1 Gigabyte (GB) A Gigabyte Is 1024 Mega bits per second for speed
Megabytes like your broadband connection
1 Terabyte (TB) A Terabyte Is 1024 Gigabytes at home.

1 Petabyte (PB) A Petabyte Is 1024 Terabyte Remember!


1 Exabyte (EB) A Exabyte Is 1024 Petabyte
1 Zettabyte (ZB) A Zettabyte Is 1024 Exabyte • bits
• Nibbles
1 Yottabyte (YB) A Yottabyte Is 1024 Zettabyte
• Bytes
Block 3

Compression and Encryption


RLE – Run-length Encoding
Text string Answer
AAAABBBBBBBBBCADDDDEEFFFFFFFF 4A9BCA4D2E8F
ABCABCABCABCABCABCABCABCABCS ABCABCABCABCABCABCABCABCABCS
BBGGYYAACCFFEEBBGGYYAACCFFEE 2B2G2Y2A2C2F2E2B2G2Y2A2C2F2E
 
Which one compresses the most? The first one.
Why is this? Because it contains the longest run lengths.
Describe in English the process the RLE calculator The calculator looks at the first character and
follows to encode a piece of text. counts this as 1. It then compares the next
character to the right with the first character. If
  they are the same, it adds 1 to the number. If
  they are different, it puts the letter. It then
starts counting again with the next letter on the
  right.
Lossy and Lossless
Explain what is meant Lossless data compression reduces the size of files in such a way
by lossless that the original data can be perfectly reconstructed from the
compression. compressed data - i.e. nothing is lost.

What type of data can Lossless data compression works best on files containing strings
be compressed using a of repeating data, whether the repeating data is characters,
lossless compression strings of letters or words.
algorithm?
Describe how a losslessA lossless RLE algorithm is a simple compression algorithm in
RLE algorithm works. which runs of data (sequences in which the same data value
occurs in many consecutive data elements) are stored as a
single data value and count, rather than as the original run. So,
for example, FFFFFFFFFFFF would be represented as 12F.
Some lossless In a lookup table, a number is assigned to repeated words.
compression algorithms Then when the compression algorithm is run, the words listed
use a lookup table. in the lookup table are replaced in the file by a number. A
Explain what the considerable size reduction can be achieved by using a lookup
lookup table is for. table and the original file can still be reconstructed without any
loss of quality.
Lossy and Lossless
Explain how lossy Lossy data compression permanently discards some of the original
compression differs data. It exploits the fact that human beings cannot detect subtle
from lossless differences in sounds and colours. Key data is retained and less
compression. important data is discarded when lossy data compression takes
place.
Explain why lossy The data in photographs and audio files contains differences too
compression is usually subtle for the human eye or ear to detect. Therefore, lossy
used for media files. compression can drastically decrease the file size by discarding some
of the data, while the quality is still acceptable to human beings.
Outline the process of The lossy compression algorithm analyses the data within the audio
compressing an audio signal. The lossy compression algorithm retains the key data and the
file using a lossy removes the non-audible or less audible components of the signal.
compression
algorithm.
Outline the process of The lossy compression algorithm divides the bitmap image into
compressing a bitmap blocks of 8x8 pixels. It then analyses the data within the 8x8 pixel
image using a lossy block and ranks it according to its importance to visual perception.
compression The lossy compression algorithm retains the key data and discards
algorithm. the less important data. It achieves this by replacing the colour
values of some of the pixels.
Misconceptions
Bandwidth (capacity) – “ I used a total of 15GB this
month”
How much capacity is used

Bandwidth (file transfer rate) – “ I was getting file


transfer rate of 20mb/s (megabits per second) while
downloading COD:AW”
Speed/maximum data can be transferred at a time it is downloaded

ISP = Internet service provider


What is symmetric Encryption?

An encryption system in which the sender and


receiver of a message share a single,
common key that is used to encrypt and decrypt
the message.
Types
Symmetric-key systems are simpler and faster, but
their main drawback is that the two parties must
• DES
somehow exchange the key in a secure way. • AES
• IDEA
Symmetric-key cryptography is sometimes
called secret-key cryptography. The most popular
symmetric-key system is the Data Encryption
Standard (DES).
What is Asymmetric Encryption?
A cryptographic system that uses two keys -- a public key known to everyone
and a private or secret key known only to the recipient of the message.
When John wants to send a secure message to Jane, he uses Jane's public
key to encrypt the message. Jane then uses her private key to decrypt it.

An important element to the public key system is that the public and private
keys are related in such a way that only the public key can be used to
encrypt messages and only the corresponding private key can be used to
decrypt them. Moreover, it is virtually impossible to deduce the private key if
you know the public key.
Types
The only difficulty with public-key systems is that you need to know the
• RSA
recipient's public key to encrypt a message for him or her. What's needed,
therefore, is a global registry of public keys, which is one of the promises of • Diffie-
the new LDAP technology.
Hellman
Public key cryptography was invented in 1976 by Whitfield Diffie and Martin
Hellman. For this reason, it is sometime called Diffie-Hellman encryption. It is
also called asymmetric encryption because it uses two keys instead of one
key (symmetric encryption).
Uses of Encryption
Users of encryption What they use encryption for
Businesses  to protect corporate secrets/sensitive information
 to protect customer data against hacking
 to protect against accidental data leaks/losses
Individuals  to protect personal information
 to guard against identity theft
Governments  to secure classified/sensitive information and to protect it
against hacking
E-traders  to send and receive confidential information such as
customers’ credit card details
 to protect customer data against hacking
 to protect against accidental leaks/losses
The military  to secure classified information/state secrets
 to protect against hacking
Block 4

Computers and Assembly Language


input-process-output model
Input Process Output

Storage

Feedback
Types of Bus
Function Type of bus
Sends and receives signals that Control bus
control the CPU and other parts
  of the computer system
Carries the address of memory Address bus
locations used to store data and
program instructions
CPU Transfers the binary data around Data bus
the computer

Input / output
Data, control and address bus
 

devices

Memory Are you more confident in being able


to explain what the bus’s purpose is?
Fetch-Decode Cycle

FETCH DECODE EXECUTE


1. Fetch the next instruction from main 3. Decode the instruction 5. Execute the instruction
memory using the memory address in
6. Store results in a register
the program counter register
4. If the instruction uses data from
2. Increment the program counter to memory, identify the memory addresses
point to the next instruction and fetch the data from memory
Hardware Categories
Identify a range of hardware components that fall in to each category

INPUT Storage (type: magnetic, Processing Communication OUTPUT


solid state, optical)
Keyboard HDD (magnetic) CPU Modem Speakers
Mouse SSD (solid state) GPU Network Card Monitor (VDU)
Touch screen Flash Memory Stick ALU Bluetooth Vibration
(USB) (solid state) feedback
Controller DVD (optical) WiFi Printer
Scanner Blu-ray (optical)
Puff Suck switch SD Card (solid state)
Foot Mouse CD (optical)
Web Cam
Hardware
Use the function to identify the hardware component.
Function Hardware component
A temporary storage area for data and program RAM (Random Access
instructions while a program is running Memory)
A microprocessor which carries out the instructions in CPU (or processor)
computer programs by performing arithmetic and logic
operations, and controls inputs and outputs

A persistent data storage area for data and program Secondary storage,
instructions e.g. hard disk drive,
solid state memory
To provide connections to the input and output peripherals Sound card, network
such as printers, mouse, keyboard, touch screen, speakers, card and graphics card
networks, and so on
Non Volatile and Volatile Memory

Elephant – ROM Fish - RAM

• Long term memory • Short term memory


• •


Slower compared with RAM
Can hold more memory
Does not forget (non volatile)
VS •

Faster compared with ROM
Holds less memory
Does forget (volatile) when
when switched off switched off
Block 5

Networking and HTML


Networks
Network Types
LAN, WAN, MAN, VAN, VLAN etc.

Network Topologies
Star, Token Ring, Mesh, Bus
What can we do with a network?
• What devices would they want to connect (laptops,
PCs, games consoles, phones)?
• How would they connect them (wired, wireless or mix)?
• How would they access the internet?
• What speeds would they want for their connections?
• Where abouts in the house would they put the router,
the printer, the NAS drive and any other devices?
• What streaming services would they provide across the
network?
• How would they protect their network from hackers
and viruses?
Research
Research the benefits and drawback of these two options, considering
security, performance, control, cost and expertise.

Here are some sites they can use:


• ‘What are the advantages and benefits of a VPN?’:
http://compnetworking.about.com/od/vpn/f/vpn_benefits.htm
• ‘How VPNs work’: http://computer.howstuffworks.com/vpn.htm
• ‘How Virtual Private Networks Work’:
http://www.cisco.com/c/en/us/support/docs/security-vpn/ipsec-ne
gotiation-ike-protocols/14106-how-vpn-works.html

This is sort of question pupils may have to answer in the written paper.
Block 6

Databases and SQL


Database Terms
Word Meaning
Database A collection of data stored in an organised and logical manner.
All of the information in a database which relates specifically to one person or
Record thing.

A piece of information stored in a database. Field names should always be


Field sensible and let users know clearly what the information is.

We can use this to search a database. It will return all of the relevant records
Query which match the criteria.

There are many different types of these. For example, date, time, integer, real,
Data Type string etc...

We can create these to make it easier for users to input data.


Form
We can use these to show information from our database in an easier to
Report
understand way.
A computerised check so that only sensible data is accepted, this is used to
Validation prevent G.I.G.O. Such as a range check (1-10) or a format check (XX564).

This is a field which is used to uniquely identify each record in the database. This
Primary Key (Key Field) is necessary in case two records in the database have the same name.
SQL SELECT
Structure:
SELECT column_name,column_name
FROM table_name
WHERE column_name operator value
ORDER BY column_name

Example:
SELECT firstName, surname
FROM Contacts
WHERE surname = ‘Lewington’ AND surname = ‘Walton’
ORDER BY surname asc

What does ‘ASC’ and ‘DESC’ do in the ORDER BY section?


SQL UPDATE
The UPDATE statement can be used to change a
values in rows that already exists. In this example
we move the 2012 games from London to Paris.

Structure:
UPDATE games
SET city='Paris'
WHERE yr = 2012;
Block 7

Issues and Impact


Digital Divide
Society’s dependence on computer technology has
increased.
The ability to communicate by email and access the
internet has become essential part of everyday life.
But there are many people in the world who do not
have access to the internet and this has led to a
disparity called the digital divide.
The areas are rural communities, low-income families,
people with disabilities, areas of the developing world
and computer illiterate.
Digital Divide
On a low People on a low income will probably prioritise essential items such as
income food, clothing, rent/mortgage and household bills. Money is likely to be
an issue if you are unemployed, a refugee, a recent immigrant, paying
back debts, etc.

Living in a Services are rolled out first in areas with the greatest population, where
rural area the infrastructure is better. This is cost-effective for the companies
because they get a greater return on their investment more quickly.
In rural areas houses can be quite far apart, so services to these areas are
reduced. Companies may be less willing to invest as it is not as cost-
effective. Sometimes people living in rural areas need to pay to get the
service installed.

Weak People with weak literacy skills may miss out on products and services
literacy because they cannot read about what is available.
skills
Digital Divide
Have a People who have a disability might not be able to operate products that
disability are aimed at the mass market, so these people have to wait until
products and services are adapted to their needs, e.g. people who are
hearing impaired have to wait for TV programmes with subtitles.

From an People from ethnic minorities may have the same problem as people who
ethnic have weak literacy skills. They might be isolated from mainstream society
minority and unaware of what is available. They might also have different cultural
values from the mainstream, which means that they do not want the
products or services that are available.

Elderly Older people might think that the technology is too advanced for them
and they will never be able to learn how to use it. This will deter them
from buying into new technology, e.g. older people might prefer writing
letters as it is what they are used to, and they may not want to switch to
email.
Computers and health
• monitoring the impact of new drugs,
• medical record keeping (may include apps IOS health app)
• robotic surgery
• life support and monitoring systems
• diagnosis by expert systems
• MRI scanning
• 3D printing of body parts
• web-connected biometric devices
• health promotion campaigns
Videos
VLE – Virtual Learning Environments
https://www.youtube.com/watch?v=QdP4_7xXXVw

‘What Is 3D Printing and How Does It Work?’.


https://www.youtube.com/watch?v=Vx0Z6LplaMU

Cloud Computing
https://www.youtube.com/watch?v=DGDtujmOBKc

VR
https://www.youtube.com/watch?v=i4Zt3JZejbg
Environment Question
AJ’s is a fast-food company with five outlets. The outlets are
connected via the Internet to the head office. Data from each outlet is
transmitted to the head office computers at the end of each day.

(a) AJ’s chief executive is concerned about the environmental impact


of using computers.

Give three possible environmental impacts of using computing


devices.

Suggest one possible action AJ’s could take to reduce the


environmental impact.
Environment
Block 8

Microcontrollers
Microcontrollers
Characteristics
• Usually embedded in other devices
• Dedicated to one task
• Usually low-powered/battery-operated devices
• Use actuators and sensors to function
What is an actuator? What are the role of sensors
• An actuator is used to in
• Aa sensor
microcontroller?
is a converter that
move or control output measures a physical quantity
• Usually a type of motor for and converts it to a signal.
moving or controlling a • This signal is used by the
mechanism or system. microcontroller to make a
decision.
Questions
Answers
Block 9

Computational Models + Emerging


Trends
Computational Models
 What is a computational model?
Computational modelling is the use of mathematics, physics and
computer science to study the behaviour of complex systems. 
 How are computational models used?
Computational models are used by computer simulators to reproduce
the behaviour of a system.

Characteristics
 Systems under study are non-linear.
 Uses realistic/actual data.
 Used by adjusting parameters and studying the outcomes.
 Usually implemented in computer simulations.

 E.g: Weather forecasting, Traffic flow, Flight simulators,


Financial models
Model Question
Model Answer
Block 10

Computational Thinking
Sort Algorithms
• Bubble sort
• Quick sort
• Heap sort
• Selection sort
• Insertion sort
• Merge sort
Depth and Breadth Search Algorithms
In some situations it is necessary to alter the order of a search in
order to make the search more efficient. To explore this we need
to understand data trees and nodes.
Other Algorithms
• Minumum
• Maximum
• Mean
• Count

What others can you think of?

You might also like