Computer SC Paper 2

You might also like

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 43

Computer Science

Paper 2 – All options (not dependent on programming language)


ICON

Number Bases
• Denary / Decimal

• Binary – why 0 & 1?

• Hexadecimal – from 0 to __ ?

Think about why some might be used over others.


Converting ICON

between bases
Denary / Decimal

Hexadecimal Binary
ICON

Binary Arithmetic
Add the following binary bit patterns: [2 marks]

01101100
+11011011
+10110100
Representing ICON

Sound
Why does sound need to be converted into binary, or a bit pattern?

What is meant by sampling?

File size =

How does increasing the ‘quality’ of the sound file size increase the size?

What can be increased?


Representing ICON

Images
What is a pixel?

Colour bit depth  how many colours possible?

File size =
Run Length ICON

Encoding
Suppose some pixels from an image form the bit pattern:
01101001111101000001

What is the file size (bits)?

How does RLE make it smaller?


Character ICON

Encoding
Letters / characters (even spaces) are not binary digits.
How do we represent them?
ASCII – 7 bits per character

Unicode – 16 bits per character

Why might one be used over another?


ICON

Huffman Coding
How many bits are needed to encode this string (ignoring the
speech marks) if ASCII is used?
‘won one in round one Juan’
Number of characters: ___, so _____ bits

Huffman coding will encode the more frequently used characters


into shorter bit patterns.
Huffman Coding ICON

Tree
Character Frequency ‘won one in race one Juan’
(space) 5
n 5
e 3
o 3
a 2
r 1
u 1
c 1
J 1
i 1
How many bits are saved using this?
w 1
Types of ICON

compression
• Lossy – quality is permanently removed, but makes the file size
much smaller
Think of ‘rounding’.

• Lossless – quality is removed, but can be restored later – this is


RLE and Huffman coding
ICON

Boolean Logic
You need to know and draw some gates, as well as their truth tables.
You may need to know their ‘symbols’
• NOT

• AND

• OR

• XOR
XOR ICON

deconstructed
An XOR gate can be made up of AND, OR and NOT gates:
ICON

Logic Gates
A laptop will sleep (S) if it is not touched for 10 minutes (T) and
if it is not plugged in (P).
Draw a diagram of logic gates to represent this system.
Software
• Application
Helps a user complete a task
May often have a ‘GUI’
Examples: Word processors, browsers…
• System
Assists the computer system with managing / running
Examples: OS, security
ICON

The OS
Handles / does / provides:
• Applications
• The CPU, memory… (see later topics)
• An interface
• Other devices, like those connected
ICON
Types of programming
languages
Here are samples of programming code in some different
languages – Python and C++. These do the same thing.
ICON
Types of Programming
Languages
• High Level – Python
These are easier for us to understand, but harder for the computers to
understand.
One line of code = several for the machine code.
Code has to be translated into ‘machine code’ by ‘assemblers’ or ‘compilers’

• Lower level – C++, machine code / assembly language


The machine code and assembly language is literally binary – it is easier for the
computer to understand, but harder for us; we speak in the ‘computer’s
language’
One line of machine code is ‘as it is’ for the computer.
ICON

Translators
• Assemblers
Convert Assembly Code to Machine Code
(Assembly code resembles commands for the CPU)

• Compilers
The whole program is translated into machine code, saved in another file, and then
executed.
Harder to find errors / debug, as errors are displayed after the code has run

• Interpreters
The program is translated into machine code, line by line, and also executed after.
It may be slower than compilers, but easier to find errors.
Storage (Link to ICON

the CPU)
What is the ‘Fetch Decode Execute’ Cycle (FDE)?
Linked to the CPU directly:
• RAM (Random access memory)

• Cache

• Registers – temporary instructions that are distributed

• ROM – loads BIOS


Comparing ICON

storage
RAM and ROM

CPU-related storage
Think about:
• Speed (how it improves the CPU’s performance)
• Size of storage
• Cost
Secondary ICON

Storage
This is what people commonly think of ‘storage’, like where applications, audio, images, etc. are
stored.

• Hard disk

• Solid state drive

• Optic disk

How do these work?


Comparing ICON

Secondary Storage
There are a few ways to compare the performance of each type
of storage. Think about:

• Price per unit storage

• Reliability / Lifespan

• Read/Write speeds

• Portability
ICON

Cloud Storage
What is meant by this?
A service where files can be transferred to external servers (run by other
companies) via the internet.

Discuss the benefits and drawbacks when using cloud storage for an office. [6 marks]
ICON

Networks
What is meant by a network?
Several computers linked together to share files and resources.

Why use a network? Why not?


Cyber Security ICON

Threats
This can be the disadvantage of using a network, as opposed to individual ones.
Which threat(s) is the most dangerous for networks?
• Malware:
• Trojan Horses
• Viruses
• Worms
How can malware get into a network, and spread?
• Getting in:
• Phishing
• Unauthorised access: shouldering, eavesdropping, blagging, misconfigured access rights
• Circulating:
• Via the network, or to those you know (emails…)
• Removable media – e.g. USB sticks
How to protect ICON

networks
• Encryption
• Symmetric

• Asymmetric

• Firewalls

• MAC Address Filtering


• Whitelisting

• Blacklisting
Protecting ICON

networks, cont.
• Authentication:
• Something you know

• Something you have

• Something you are

• CAPTCHA

• User access levels


ICON

Network Sizes
Three types to consider:
• PANs

• LANs

• WANs
ICON

Connections
How are devices connected in a network?
• Wired

• Wireless
Network
Topologies
Bus Star
ICON

Network Protocols
What is meant by a ‘protocol’?
A set of rules for how devices communicate in a network (or how
data is sent) Layer # Name Protocols

4
The Layer Model
3

1
Network Protocols
– Layers 4 & 3
L4 – Application L3 – Transport
HTTP/S Packet Switching
TCP and UDP
FTP

IMAP

SMTP
Network Protocols
– Layers 2 & 1
L2 – Internet L1 – Link
This links into the packet This involves the network
switching, with… hardware and the topology.
IP addresses Which topology would be
better now, and why?
Computer
Legislation
The Computer Misuse Act GDPR
“1. Unauthorised access to computer material. Data must be:
2. Unauthorised access with intent to commit or facilitate com • Used fairly, lawfully and transparently
mission of further offences.
• Used for specified, explicit purposes, and only necessary
3. Unauthorised acts with intent to impair, or with recklessness
as to impairing, operation of computer, etc. • Accurate and up to date
3ZA.Unauthorised acts causing, or creating risk of, serious dam • Kept for no longer than necessary
age
• Handled securely
3A.Making, supplying or obtaining articles for use in offence un
der section 1, 3 or 3ZA

ICON

Other Legal issues


• Copyright, patents…
Those breaking these laws – piracy, cracked software…
On the other hand – copyleft, ‘fair use’

• Responsibility – can robots be accountable when breaking laws


like humans (murder – 2 train tracks problem…)
Ethical Issue 1 -
Hacking
• Which law does this break? Can hacking be useful?
Penetration testing
• How can this happen – • White-box
services, devices…?

• Things connected to any • Black-box


network, especially the
Internet (it is a WAN) are
vulnerable
Issue 2 – Data
Access / Privacy
Situation: Suppose someone you have contact with (e.g. by email, phone…) is accused of being
radicalised; a threat to the public. Now you, and others are now investigated by the police.
You think you are innocent. Should the police have access to your communications, as well as
others’?

• Data is already encrypted • ‘Greater good’ for society


asymmetrically, or ‘end-to-end’ • We can prevent incidents in in the
• ‘Backdoors’ to encryption – if the future
government can see the data, who • ‘Nothing to hide’
else can?
• Can the data be misused?
Issue 3 – The ICON

Environment
Link to other subjects – Life Cycle Assessments
• Whenever new devices are made, raw materials are needed
• Electricity is used – how is it produced, how much is needed?
This may include servers, schools… that constantly use power
• At disposal, some materials cannot be recycled
• This ‘eWaste’ can be transferred elsewhere
SQL – Santa’s ICON

database
ID # Name Country Age Gift wanted Behaviour

1 Nakamura, JPN 12 Shogi set NICE


Hikaru
2 Doe, John FRA 6 Leclerc tank NAUGHTY

3 Levon, Harvie COL 9 Chitarra pasta NICE


cutter
4 Aronian, Leon USA 10 1kg Ground NAUGHTY
Beef
5 Frens, Sievert GER 7 Uranium NAUGHTY
ICON

SQL Statements
What does this command return? ID
#
Name Country Age Gift
wanted
Behaviour

1 Nakamura, JPN 12 Shogi set NICE


Hikaru
2 Doe, John FRA 6 Leclerc tank NAUGHTY

3 Levon, Harvie COL 9 Chitarra NICE


pasta cutter
4 Aronian, Leon USA 10 1kg Ground NAUGHTY
Beef
5 Frens, Sievert GER 7 Uranium NAUGHTY

6 Herbert, FRA 12 Bread NICE


Nicholas Maker
ICON

SQL Statements
Now delete all details of the ID # Name Country Age Gift
wanted
Behaviour

‘NAUGHTY’ records. 1 Nakamura,


Hikaru
JPN 12 Shogi set NICE

2 Doe, John USA 6 Leclerc tank NAUGHTY

3 Levon, Harvie COL 9 Chitarra NICE


pasta cutter
4 Aronian, Leon USA 10 1kg Ground NAUGHTY
Beef
5 Frens, Sievert GER 7 Uranium NAUGHTY

6 Herbert, FRA 12 Bread NICE


Nicholas Maker
Relational ICON

Databases
Santa then hires distributors to deliver the gifts:
Each country has a distributor, which can be shared by others

Write an SQL command, that: Country Distributor


• Returns the child’s name USA FedEx
GER DHL
• And the distributor they are expecting
FRA DHL
COL Linage
JPN DHL

You might also like