Binary is used to represent
data and program instructions
as 1's and 0's
1 bit = can have 2 combinations
2 bits = can have 4 combinations
Converting Binary to Denary
Converting Denary to Binary
Binary Addtion
0+0 = 0
1+0 = 1
1+1 = 10
1+1+1 = 11
Overflow error - occurs when a calculation produces
a result that is greater then the computer can deal
with e.g. if from an 8 bit addition you require a 9th
bit
Logical Shifts
Signed integers
Two's complement
Converting Two's complement
converting a number - step 1 - flip
the 0's with 1's and 1's with 0's
Step 2 - add Denary one to the binary digit
Adition Two's complement
This is the same as normal
addition, but you must convert
the numbers to two's
complement first
This format 0 can only be
represented one way as
000000 and calculations are
always accurate.
Arithmetic shifts
this is the same as logical shift,
however the MSB will stay the
same.
This is used to represent negative numbers
within binary, with a most significant bit (MSB) is
used to show a positive ore negative number.
The leftmost bit shows if the number positive
(with a 0) or negative (with a 1).
The issues is that you can
only Represent 128
combinations as the 8th bit is
the MSB
Also using this
method 0 can be both
positive and negative
10000000 or 00000000
Hexadecimal
Used to help humans cope with long strings of binary digits (they are shorther)
It is used to represent errors within a computer
Characters
Computers represent text,
numbers and symbols as
binary strings of 1's and 0's
ASCII - is a way of represent
text as an 8 bit code which
can hold 256 characters.
Each characters has a binary
number e.g. A = 01000001
You can find ASCII codes with
some pre-built function from
Pseudo code. The ord() function
returns the number e.g.
ord("C") would shown 99. The
chr() function returns the letter
e.g. chr("99") would shown c
Images
Computers
represent images
as a sting of 1's
and 0's
An images is made up of small
points of colours called pixels,
with each one having its own
colour, the more pixels the
more ddetail will be shown
within the image
Colour depth = the number of bots used to encode the colour of each
pixel, the more bots uses the more colours can be represented e.g. 8
bits or a colour depth of 8 would show 256 colours within the image
Resolution = the
number of pixels
within the image
Calculating file size = width x height x colour depth
Sounds
Computers represent
images as a sting of 1's
and 0's via analogue to
digital recording
Sound sampling - samples of sounds waves
are taken at regular fixed intervals.
Bit depth - the number of bits used to encode
each sound sample. Higher the bit depth the
more accurate recording with a bigger sound
file e.g. a bit depth of 24-bits would have 16.7
million combinations
Sample frequency x bit depth x length of recording (in seconds)
Units
This denotes the size of a file (to
make it easy to identify through
different units)
To convert between different
units we need to multiply or
divide. E.g. 2341200000 bits to
GB’s - 2341200000 / 8
/1024/1024/1024 = 0.27GB’s
Data Compression
Lossless compression - reduces the file
size without deleting any data via
grouping some data - good for text files
Run-Length encoding
This is lossless compression
algorithm to get reduce a file size
through the removal of duplicate
data
Lossy compression - deleting some data from
the file which you cannot get back through
taking out very small veriations in sounds
which humans era cannot detect. e.g. good for
videos and images, JPG and MP3 an examples
of this compression
Compression is needed for
less internet band width for
downloading, transfer speed
faster, less storage space, so
you can stream online
Databases
Unstructured data - data that is not orgonised.
Structured data - data that is stored in an organised
and ordered way so that it can searched. e.g a
database
A Databases is a persistent and organised store of data
Entities - are a thing which is recognised as being capable
of an independent existence and which can be uniquely
identified.
e.g Students will be entities within a database
with Attributes of name, ID, Year, Age
Tables are used to represented each
entity with attributes as the column (a
field) and a Row is a record of data
Primary Key - a unique identifier that cannot be duplicated within a table (e.g. Book_ID)
Relational databases
A database which has multiple tables and can be
linked to reduce data redundancy
A relational database allows data elements in one table
to be related to any piece of data in another table so long
as a Foreign key is within the table
Foreign key - so tables can be linked, this is a
primary key on one table and is on another table
as a foreign key
No data inconsistency – as
data is not duplicated, there is
no risk of the same data item
being stored differently in
another record.
No data redundancy – in a
well-designed relational
database there should be no
duplicated data (other than
the key field).
Encryption
Data should be encrypted to ensure
that unauthorised people cannot
read it. Encryption is a way of
scrambling of data intoa form that
cannot be understood by
unauthorised people
Encryption protocols -
HTTPs with the SSL in
the transport layer and
TLS protocol added to
the message
Asymmetric encryption
This method encrypts and decrypts data
using 2 different keys. Each user a public
key (known to everyone) and a private key
(only know by themselves) . A message can
only be decrypted by the corresponding
private key
Symmetric encryption
This method uses the same
key to encrypt and decrypt
data. This is the method used
by HTTPs
The Caesar Cipher
his is a simple encryption method and would
not be used today because it is so easy to
crack. The letters of the alphabets are shifted
a set number of places. A positive shift the
the right and a negative shift to the left