All Help
All Help
All Help
System Architecture
A Computer is an Electronic Device that:
Takes an input.
Processes data
Gives an Output
It fetches instructions from the main memory (RAM) and brings it back to the CPU.
It then carries out the instruction. This can result in going back to the main memory
to get more data, performing a calculation, or storing data back in the main memory.
It is based on the concept of the stored-program concept. Both instruction data AND
program data are stored in the same memory in binary form. There is no way to
know if the pure binary held in memory is representing instructions or data simply by
looking at it.
Typical properties include: Low power consumption, Small size, Rugged operating
ranges, Low cost per unit.
RAM holds the operating system, programs and data in use by the CPU when the
computer is running. It is Volatile, read and write, and large in comparison to ROM.
ROM holds the first instructions for when the computer is first turned on known as
the bootstrap. Programs may be stored in ROM in embedded systems. It is Non-
volatile (contents remain when power is turned off), read only, and small in
comparison to RAM.
Virtual memory is needed when there is not enough physical RAM to store the open
programs. Virtual memory is held on the hard disk.
Programs are transferred out to Virtual Memory from the RAM when they are not
currently being executed.
Programs are transferred back to RAM from Virtual Memory when they are needed.
Secondary storage is needed because ROM is read only and RAM is Volatile ( data
is lost when power is lost ). It is needed for:
The units of Data storage are : Bit, Nibble, Byte, Kilobyte, Megabyte, Gigabyte,
Terabyte, Petabyte.
A bit is a binary value of 1 or 0. A nibble is 4 bits. A byte is 8 bits. A kilo Byte is 1024
bytes. A Megabyte is 1024 Kilobytes. A Gigabyte is 1024 Megabytes. A Terabyte is
1024 Gigabytes. A Petabyte is 1024 Terabytes.
Binary is processed in 2 states. 1/0 or on/off. With two states, electronic components
are easier to manufacture, more cheaper, and more reliable.
Calculating text files = Bits per character x number of character
Calculating image file = Colour depth x image height (pixels) x image width (pixels)
In order to convert Binary into denary you would use a Binary Number Line. Below is
an example of a 8 binary long number line. E.g. 10010101
Denary 128 64 32 16 8 4 2 1
Binary 1 0 0 1 0 1 0 1
You would then place find out the denary values for each 1. In this Binary Sequence
is the, 128, 16, 4 and 1. You would then add them together. 128 + 16 + 4 + 1 = 149.
Therefore, 10010101 = 149.
0+0=0
1 + 0 = 1. 0+1=1
1 + 1 = 0 ( carry the 1 )
1 + 1 + ( carry 1 ) = 1 ( carry the 1 )
An Overflow error occurs when a 1 is carried over into the 9 th bit section despite
the integer being only 8 bits.
Hexadecimal is another way of presenting data. They use 2 , 4 bit integers to create
a 2 digit number, letter or both.
If you have the 8-bit binary integer: 11010101. You would split that into: 1101, and
0101
D = 13. 13 x 16 = 208
5 = 5. 5x1=5
Binary shifts are used to double or half binary digits. Binary shifts to the left increase
the binary value whereas binary shifts to the right decrease. A 1/0 can fall off the 8 bit
binary integer if it passes the 8 bit line. Aswell as that a 0 will be automatically be
added at the end / start of the new binary integer.
The number of bits required for each pixel depends on the number of colours
required. E.g. 1 bit has 2 possible values therefore can store up to 2 colours. 2 bits
have 4 different values therefore can store up to 4 colours. Number of colours can
be calculated by 2 ^ n where n is the number of bits for each pixel. The number of
bits for each pixel is also known as the colour depth.
Metadata is additional data stored with the image to define the width, height, colour
depth and colour palette.
The greater the colour depth and resolution, the larger the file size of the image.
Sound file size is the total number of bits in a sound and is calculated as the number
of samples per second x number of bits per sample x length of sample in seconds
Bit Depth is the number of bits stored per sample. The higher the number of bits, the
greater the quality of sound and larger the file size.
Sample rate is the number of samples stored per second. The higher the number of
samples per second, the higher the quality of the sound and the larger the file size.
Compression is reducing the number of bits in a file. It makes the storage capacity of
the file lower. Allowing data transfer of the file to be quicker. It is useful as more data
can be stored on a storage device and transferred in a smaller amount of time.
Lossy Compression:
Lossless compression:
LAN (local area Network): covers a small geographical area located on a single site.
All the hardware for a LAN is owned by the organisation using it. LANs are wired with
UTP cables, fibre optic or wireless with Wi-Fi.
WAN (wide area Network): covers a large geographical area, connecting LANs
together. Infrastructure between the LANs is leased from telecommunication
companies who own and manage it. WANs are connected with telephone lines, fibre
optic cables or satellite links.
Personal home devices for connecting to The Internet tend to be multi-function, all-
in-one devices acting as: Switch, Router, Wireless Access Point.
Bandwidth: The amount of data that can be sent and received successfully in a
given time. This is not a measure of how fast data travels but how much data can
be sent on the transmission media. Measured in bits per second, often called bit
rate.
Number of Users: Too many users or devices on the same network can cause the
network to slow down if there is insufficient bandwidth for the data.
Transmission Media: Wired connections have a higher bandwidth that wireless
connections. Fibre Optic cables have higher bandwidth that copper cables.
The Error Rate: Less reliable connections increase the number of errors that
occur in data transmission. This means data has to be resent. The signal quality
of wireless connections is dependant on the range of devices from the wireless
access point and other environmental factors. The signal quality of copper cables
is determined by the grade of material used which reduces interference. The
length of the cable is also a factor.
Latency: The delay from transmitting data to receiving it. Latency is caused by
bottlenecks in the infrastructure of the network, e.g. by not using switches to
appropriately segment traffic on a network. Hardware such as switches and
transmission media may not operate at the same speed.
Client-server networks. A server controls access and security to one shared file
store. A server manages access to the Internet. A server manages printing jobs. A
server provides email services. A server runs a backup of data. A Client makes
request to the server for data and connections.
Advantages:
Disadvantages:
Advantages:
Disadvantages:
Websites are stored on servers dedicated for this purpose. This is known as hosting.
Hosted solutions provide 24/7 access, multiple users and greater security. Servers
that store data and programs remotely that can be accessed and used over The
Internet are referred to as cloud storage. They provide anything, anywhere,
automatic backup and collaboration of documents.
Servers provide services (e.g. Web server -> Web Pages, File Server -> file
storage/retrieval). Clients request / use services from a server.
A network topology is a given arrangement of all the elements that you need for
networking.
Star network Topology: Most popular wired type of network. Has a central switch. All
devices are connected into the central switch. The switch is intelligent and makes
sure traffic only goes to where it is intended. If a single cable breaks only that
computer is affected. The switch however is still a serious point of failure.
Full Mesh network: Every device is connected to every other device. Advantages is if
you get a break in any of your connections you can still route your traffic via another
route. Disadvantage is that there is a lot more cabling and switch hardware required
which will add to the cost for large networks.
Partial Mesh Network: Multiple routes exist between different devices however every
single device is not connected to every single other device. A compromise solution
which lowers the amount of hardware needed compared to a full mesh network.
Users location is limited by the need for a physical cable connection. A set up relying
on ethernet relies on lots of cables, connections, ports and physical hardware which
will affect cost.
Wi-Fi: Common standard for wireless networks. Users can move around freely, less
expensive and easier to set up, convenient to use, can handle large number of
users, transfer of information to social media is much easier, speeds are slower than
wired networks, Relies on signal strength to the wireless access point (WAP), signal
can be obstructed, less secure than wired networks.
Bluetooth: more modern standard for wireless networking. It is ideal for connecting
personal devices, it has a very short range, is has a very low power consumption
compared to Wi-Fi.
Although wired networks are naturally more secure, encryption is still available and
often a sensible precaution.
MAC addressing is used to route frames on a local area network. Each MAC
address is unique to every network interface card.
IP addressing is used to route packets on a wide area network. There are 2 types,
IPc4 and IPv6. IPv4 are 32 bits in size, written in four numbers separated by
periods, each number in the range 0-255. Ipv6 are 128 bits in size, written in eight
groups separated by colons, each group made up of four hex values representing 16
bits.
A router with a unique WAN facing IP address and a LAN facing IP address. This
enabled a LAN device to have the same IP address as another device on another
LAN.
Standards are a set of specifications for hardware and software. It makes it possible
for manufacturers to create products and services which are compatible with each
other. Without standards most devices wouldn’t be able to successfully interact with
or communicate.
The concept of layering is to divide the complex task of networking into smaller,
simpler tasks that work with each other. Advantages of layering include: Reduces the
complexity of the problem into manageable sub-problems. Devices can be
manufactured to operate at a particular layer. Products from different vendors will
work together.
TCP/IP protocol and use of layers: This is one of the most important protocol
stacks in use today. A set of networking protocols consisting of four layers all
working together. All incoming and outgoing data packets pass up and down
through the various layers when you communicate on a network.
The Application layer uses an appropriate protocol relating to whatever
application is being used to transmit data. ( HTTP, HTTPS, FTP etc )
The Transport layer uses the TCP part. It is responsible for establishing an
end-to-end connections. Once the connection is made it splits the data to be
transmitted into packets. It adds to each packet: A number, the total number of
packets and the port number the packet should use.
The network layer uses the IP part. It adds to each packet: Source IP address
and Destination IP address. All routers operate at this layer. They use the IP
address to know the destination the packets are heading to.
The Link layer represents the actual physical connection between various
network nodes. It is responsible for adding the unique MAC address of the
source device and the MAC address of the destination device. The MAC
address is changed at each hop on the route.
Network Security
Malware is software which is specifically designed to disrupt, damage or gain
unauthorized access to a computer system. E.g. Viruses, Worms, Trojan horses,
ransomware etc.
Brute force attacks are a trial and error method of attempting passwords and pin
numbers. Automated software is used to generate a large number of consecutive
guesses.
Denial of Service attack ( DOS ) is flooding a server with useless traffic causing that
server to become overloaded and unavailable.
In order to prevent Malware you could have strong security software (Firewall, Spam
filter, Anti-virus, Anti-Spyware, Anti-Spam). Enabling OS and security software
updates. Being cautious of opening email attachment and downloading software and
backup files regularly onto removable media.
In order to prevent Phishing you could have strong security software, awareness of
spotting fake emails and websites, not disclosing personal or corporate information,
disabling browser pop-ups.
In order to prevent Brute Force Attacks, lock accounts after 3 password attempts,
use progressive delays, using effective passwords with symbols, letters, numbers
and mixed case. Using challenge response e.g. I am not a robot and ReCAPTCHA.
In order to prevent DOS attacks, you should have a strong firewall, packet filters on
routers, configuring the web server, auditing + logging and monitoring of systems.
In order to prevent Data interception and theft, you should use encryption have
virtual networks, use of passwords, locking computers, logging off and use of
portable media. Investigating you own network vulnerabilities.
In order to prevent SQL injection you should have validation on input boxes, using
parameters queries, setting database permissions and have penetration testing.
System Software
On operating system provides a platform on which the user can run programs. A
utility software is used to maintain the computer system.
A Graphical User Interface (GUI) is optimised for mouse and touch gesture inputs. It
is interactive, intuitive and visual. A Command line is text bases, less resource heavy
and has more commands compared to a GUI. It is efficient and for advanced users.
It is useful for automating processes with scripts. A Menu interface has successive
menus presented to the user. Single options chosen at each stage and often with
buttons on a keypad. Natural language interface responds to questions in spoken
language, not always reliable and is getting better all the time.
Memory management is when programs are loaded, the OS decides where they are
held in memory. Over time the memory becomes fragmented as programs are
loaded and closed because they use different amounts of memory. The OS must
keep track of different program fragments. When the memory is full, the OS uses
virtual memory.
Device Drivers translates OS instructions into commands that the hardware will
understand. Each peripheral need a device driver. Many are already built into the
OS.
User management:
File Management:
Encryption
Utilizes an algorithm to scramble plain text into cipher text.
The text can only be decrypted and made readable again with a master key.
Defragmentation
Reorganises files on a hard disk, putting fragments of file back together and it
collects together free space.
This reduces the movement of read/write head across the surface of the disk
which speeds up file access
Solid state drives should not be defragmented
It is unnecessary as they have no moving parts.
It also reduces their lifespan
Data Compression
Reduces the size of a file so that it takes up less space and is quicker to
download over The Internet.
Compressed files must be extracted before they can be read.
Depending on the algorithm used data is either lost, reducing the quality of an
image or sound, or represented in a different way using binary retaining the
original data in a new compressed format.
Open Source:
Users can modify and distribute the software. Can be installed on any number of
computers. Support provided by the community. Users have access to the source
code. May not be fully tested.
Proprietary source:
Users cannot modify the software. Protected by Copyright Design and Patents Act.
Usually paid for and licensed per use or per computer. Supported by developers.
Users do not have access to the source code. Tested by developers prior to release
although they may run beta programmes.
Algorithms
Abstraction is the process of removing unnecessary details and including only the
relevant details. It focuses on what is important in problem solving.
An Input is anything which needs to be supplied to the program so it can meet its
goal. Often input by the user. Consider and appropriate variable name and data type
for the input.
Outputs consider what your program needs to output. Consider what form this output
needs to take. Consider an appropriate variable name and data type for any output.
Structure Diagrams:
Rectangle ( Process ).
Rhombus ( Decision ).
Rectangle with two extra vertical lines ( Sub-routine ).
Oval – ( Start/Terminal ).
Parallelogram ( Input/Output )
Arrow ( Program Direction ).
Syntax errors: Errors which break the grammatical rules of the programming
language. They stop it from being run/translated.
Logic errors: Errors which produce an unexpected output. On their own, they wont
stop the program running.
Trace Tables:
Vital skill for understanding program flow and testing the accuracy of an
algorithm for logic is called ‘Tracing Execution’.
Involves examining a printed extract of program code and running thorough
the program.
Take each line at a time and write out in a trace table the current state of each
variable.
Noting down any output the program produces.
Each variable present in the program should have its own column in the trace
table.
A new row should be added under any column if the state of a variable
changes.
Trace tables are an excellent way to track down logic errors in a problem.
Binary Search: Calculate a mid-point in the data set, Check if that is the item to be
found. If not, if the item to be found is lower than the mid-point, repeat on the left
half of the data set, if the item to be found is greater than the mid-point, repeat on the
right half of the data set. Repeat until the item is found or there are no items left to
check. Required the data set to be in order of a key field. More efficient than a linear
search.
Linear Search: Starting from the beginning of a data set, each item is checked in turn
to see if it is the one being searched for. Doesn’t require the data set to be in order.
Will work on any type of storage device. Efficient for smaller data set. Very inefficient
for large data sets.
Bubble Sort: Sorts an unordered list of items. It compared each item with the next
one and swaps them if they are out of order. The algorithm finishes when no more
swaps need to be made. In effect it bubbles up the largest ( or smallest ) item to the
end of the list in successive passes. This is the most inefficient of the sorting
algorithms but is very easy to implement. This makes it a popular choice for very
small data sets.
Merge Sort: A Very efficient method of performing a sort. Uses a divide and conquer
method. Creates two or more identical sub-problems from the largest problem
solving them individually. Combines their solutions to solve the bigger program. Data
set is repeatedly split in half until each item is in its own list. Adjacent lists are then
merged back together. Works very well for large data sets.
Insertion Sort: Inserts each item into its correct position in a data set one at a time. It
is a useful algorithm for small data sets. It is particularly useful for inserting items into
an already sorted list. It is usually replaced by more efficient sorting algorithms for
large data sets.
Programming Fundamentals
A Variable is a value stored in memory that can change while the program is running.
A Constant is a value that does not change while the program is running, and is
assigned when the program is designed.
Casting is converting a variable from one data type to another. A Variable can be an
integer, character, string, real ( float ) or Boolean.
An Output is the data generated by the computer and displayed to the user.
Constants make a program easier to read as the yare usually declared and assigned
at the top of the program. Constants can easily be changed by the programmer in
one place in a program. Instead of changing every instance of a value throughout a
program. This leads to less chance of errors. The compiler can optimise the code.
This makes a program run more quickly if constants are used instead of variables.
Open the file for creating / overwriting or appending to a file. Write the data to a file.
Close the file.
Open the file for reading data. Assign a Boolean variable to ‘false’ to indicate the end
of file is not reached. While the end of file is false and the search item is not found:
Read the data from the file. If the data matches what is being searched for, assign
the data to variables or output. Check if the end of the file has been reached and
assign the Boolean variable to ‘True’. Close the File.
Serial text files provide us with a simple way to store data when a program is not
running. The contents of variables are effectively copied from volatile storage ( RAM
) and stored permanently in a text file, allowing the program to use the same data
when it is run again later. Storing data in text files is useful for small amounts of data
such as game configuration files.
Structured data and records can also be loaded and stored in arrays or lists. Access
to the data is extremely fast because it is being held in RAM. However, data stored in
this way cannot be accessed simultaneously by multiple users on different
computers. Arrays and lists are suitable for small data sets and typically used to hold
data read in from a file because arrays and lists are quicker to access and
manipulate.
A Record Structure is a collection of related fields. A Field is a variable. Each field in
a record can have a different data type.
Records stored in databases are often stored on remote servers. Often used to store
data shared by multiple users. Data is stored in records and fields. Use Advanced
data structures to store data efficiently. Data can be searched and sorted using
highly efficient algorithms. More secure than text files. The order of database fields is
independent of the code.
SQL is used to create, delete, modify and manipulate records in a database. Basic
commands include:
In order to use the feature of randomness in a program you will have to import it with
the code ‘ import random ‘. Use can then use the feature ‘ randint ( x , y ) ’to
generate a random letter or number between the parameter (x) and parameter (y).
Anticipated Misuse can be: Division by zero, Communication error, Printer and other
peripheral errors, disk errors.
Authentication: Data used by systems should be secure. This can be achieved with,
Username and passwords to access systems, Recovering a password requiring
clicking on a link within the email that is sent to the registered address, Encryption of
data files. Online bots can submit data automatically to online forms. This can be
protected against by using software such as reCAPTCHA that verifies the user is
human. Programmers should also be aware of the potential for SQL injection hacks
and other methods used by hackers.
Logic errors are when the program runs but does not give expected output. Logic
errors can happen because: Conditions and arithmetic operations are wrong.
Sequence of commands is wrong. Division by zero. Exceptions ( File not found )
Types of Testing:
Iterative Testing
Each new module is tested as it is written.
Program branches are checked for functionality.
Checking new modules do not introduce new errors in existing code.
Tests to ensure the program handles erroneous data and exceptional
situations.
Final / Terminal Testing
Testing that all modules work together.
Testing the program produces the required results with normal, boundary,
invalid and erroneous data.
Checking the program meets the requirements with real data.
A beta test may find more errors.
Types of Test Data:
Normal Inputs
Data which should be accepted by a program without causing errors.
Boundary Inputs
Data of the correct type which is on the edge of accepted validation
boundaries.
Invalid Inputs
Data of the correct type but outside accepted validation checks.
Erroneous Inputs
Data of the incorrect type which should be rejected by a computer system.
This includes no input being given when one is expected.
Making sure only data of the correct ‘data type’ are entered.
Binary representation of instruction s in a format that the CPU can decode and
execute. Have an operation code instruction and address or data to use.
Source code is written in languages such as Python, C++, Java etc. Translated by a
compiler or interpreter into machine code. Makes the writing of computer programs
easier by using commands that are like English. One source code instruction
translates to many machine code instructions. Code will run on different types of
processors. The programmer has lots of data structures to use. Code is quicker and
easier to understand and write. Less memory efficient. Code can be slower to
execute if it is not optimised.
Translators are used to turn high level source code into binary machine code for
execution.
Compiler
Translates source code from high level languages into object code and then
into machine code ready to be processed by the CPU.
The Whole Program is translated into machine code before it is run.
Advantages
No need for translation software at run-rime.
Speed of execution is faster.
Code is usually optimized.
Original source code is kept secret.
Disadvantages
Source code is easier to write in a high-level language, but the program
will not run with syntax errors which can make it more difficult to write the
code.
Code needs to be recompiled when the code is changed.
Designed for a specific type of processor.
Interpreter
Translates Source code from high level languages into machine code ready to
be processed by the CPU.
The program is translated line by line as the program is running.
Advantages
Easy to write source code because the program will always run, stopping
when it finds a syntax error.
Code does not need to be recompiled when the code is changed, and it is
easy to try out commands when the program has paused after finding an
error.
This makes interpreted languages very easy for beginner programmers to
learn to write code.
Disadvantages
Translation software is needed at run-rime.
Speed of execution is slower.
Code is not optimised.
Source code is needed.
IDE ( Integrated Development Environment )
Debugging tools for finding logic errors
Breakpoints – stopping a program at a line of code during execution.
Stepping through lines of code one at a time to check which lines are
executing.
Tracing Through a program to output the values of variables.
Help with preventing and identifying syntax errors.
Illustrating keyword syntax and auto-completing command entry.
Error highlighting.
The compiler produces and output of the error message to help identify it.
Providing a run-time environment
Output window.
Simulating different devices the program can run on.
Usability functions
Navigation, showing/hiding sections of code.
Formatting source code
Find and replace
Comment or indent regions.