Computer Science Notes
Computer Science Notes
1. A complex device that has multiple functions such as storing, processing and finding
data according to instructions
2. It helps organize store and retrize data using binary and show it in visual or auditory
form
What is representation?
Lightbulbs
1=2 on/off
Homework
4=16
x=2x
10=1024/210
Binary System
- The binary system is used because computers only understand yes and no’/1and0
8 4 2 1
1 0 1 1
(1x8)+(0x4)+(1x2)+(1x1)=11
Denary number 5
Divided by 5
2 2 remainder 1
2 1 remainder 0
2 0 remainder 1
2 19 remainder 1
2 9 remainder 1
2 4 remainder 1
2 2 remainder 0
2 1 remainder 0
2 0 remainder 1
=100111
Denary number 39
Divided by 42
2 21 remainder 0
2 10 remainder 1
2 5 remainder 0
2 2 remainder 1
2 1 remainder 0
2 0 remainder 1
=101010
Hexadecimal System
1,2,3,4,5,6,7,8,9,A,B,C,D,E,F
16
0E9C
F=1111
9=1001
3=0011
5=0101
B=1011
F=1111
0=0000
8=1000
C8F
15x1=15
8x16=128
12x256=3072
total=3215
BF08
8x1=8
0x16=0
15x256=3840
11x4096=45056
total=48904
16 248 remainder 3
16 15 remainder 8
16 0 remainder 15(F)
16 remainder
16 remainder
16 remainder
ASCII
American standard code for information interchange was made to send typed messages
over telegram, telephone lines etc.
In ASCII
Decimal 65= Hex 41= Binary 01000001= character A
Decimal 66= Hex 42= Binary 01000010= character B
Decimal 67= Hex 43= Binary 01000011= character C
ASCII starts at 32 because everything before that is useless in modern computers eg. send
line, send a message down
Ikram
128 64 32 16 8 4 2 1
I = 73 = 01001001 1+8+64=73
k=107= 01101011 1+2+8+32+64 =104
r=114= 01110010
a=97= 01000011
m=109=01101101
I h a v e 1 2 a p p l e s
Storage
The following are the commonly used comercial term or storage
Bits are the smallest form of storage
A nibble (4 Bits)
A byte(8 Bits or 2 Nibbles)
Kilobyte = kB(1,000 Bytes)
Megabyte = MB(1,000 kilobytes)
Gigabyte = GB(1,000 Megabytes)
Terabyte = TB(1,000 Gigabytes)
Petabyte = PB(1,000 Terabytes)
If it has “bi” in the name, it’s a real amount as it's to a power of two and not just a marketing
term eg.
Kibibyte=1,024 Bytes as it's 210 bytes
Image Representation
Lossy and Lossless compression
- One way to reduce the file size of an image (or of any file) is to compress it.
- Algorithms are used to reduce the number of bits required for each file.
- These algorithms are called compression algorithms
- Once a file is compressed, it must be decompressed via a decompression algorithm
- Lossy compression will always lose some data, meaning it will never be an exact
copy of the original, it will just be an approximation. An example of one is a jpeg
- Lossless compression will never lose data and will always be identical, however, it
will compress a lot less than lossy compression
- Lossy data loss can be very bad, however it won't always be bad as it removed
redundancies that humans cant see
- For photo compression, a group of nine pixels is just assigned one colour, and can
be achieve 90% compression
- For audio, it will cut out sounds the human ear cannot hear like very high or very low
sounds, this can leade to 90% compression
- Lossy compression can be used effectively for sound and images as it will not impact
people final experience , however that is not the case for text as removing anything
would lead to noticeable errors that would not be able to be fixed when the file is
decompressed
- Lossless compression is important for text compression as any letterers or words are
not lost during compression
- When using lossless compression, nothing will be lost and the file will be restored to
it's exact original state
- Lossless is used mainly for high quality images
- A comon example is a png file, which is popular due to transparent pixels
- Another one is zip files, which are used to store multiple files in on until they are
needed
Computational thinking
Computers can only think logically, not creatively
Computational thinking: Computational thinking is a systematic approach to solving
problems. It can be understood by a computer and humans
Decomposition: Decomposition is the process of breaking problems down into smaller parts.
Abstraction: Abstraction is the process of removing unnecessary information and focusing on
the important details.
Algorithmic thinking: Algorithmic thinking is the process of developing an algorithm to solve a
problem.
Pseudocode
Commonly used in computer science
The person reading it can understand it even without knowledge of a programming language
Assignment statement
A value is assigned to an item/variable
The variable is a container for storing a value
Fortran and COBOL were created as the first high-level languages. These allowed
programmers to write programs in formal, structured English. High-level languages made it
easier to read, maintain, and debug code. This meant that programming computers became
more suited to a wider audience.
These high-level languages could write one line of ‘plain English’ code that would then be
translated to dozens of lines of machine code.
IDE: They allow you to write and run programs more easily via things like syntax colour-
coding, highlighting important syntax structures, or even auto-completing lines of code.
In programming, there are naming conventions that should be followed to make it easier to
read and understand your code.
Variable: A variable holds a value in a memory location that is needed for the execution of
your program. A variable can hold one value at a time. This value can change throughout the
execution of the program.
Memory location: A memory location needs to be allocated for the variable value before it
can be used by the program.
Declaring: a variable means stating what data type will be used for the value.
Once a variable has been initialized with its first value, it can then be reassigned a new value
throughout the execution of the code.
Study stuff
- Acii/unicode
- World wide web
- Probably lossly lossles data
- Probably image size calculation
- Probably sound size calculation
- Possibly different sata types and what they do plus examples
- May be asked conditional statements
- Maybe a piece of code thats not a cookie shop that will have questions
Disadvantages
- Packets must we reassembled in the right order as they will arrive randomly
- Packets may sometimes go missing(data packet error)
Header contains
- Sender IP Address
- Receiver IP Address
- Sequence number of the packet: This is to ensure that all the packets can be
reassembled correctly once they reach the destination.
- Size of the packet: This is to ensure that the receiving station can check if all of the
packets have arrived.
SSSR(acronym)
Payload contains
- The actual data(pretty simple)
Trailer contains
- A signal that basically says the end, you have received the whole packet
- Instructions on how to do a validation check( Cyclic reduction test)
Cyclic reduction test(Important)
Disadvantages
Although you can check if the amount of ones are correct, you also don't check their
position, meaning that even if two numbers change position it could be calculated as correct
incorrectly
Packet switching(Payload)
- Packet switching is a method of data transmission in which a message is broken up
into a number of packets.
- Each packet can be sent independently from start point to end point.
- At the destination, the packets will need to be reassembled into their correct order.
- At each stage in the transmission there are nodes that contain a router.
- Each router will determine which route the packet needs to take, in order to reach its
destination (The destination IP address is used in this part of the process).
Diagram
Parallel
USB is a type of communication port that has been built into computers in order to do away
with other older forms of port.
USB is now the most common type of input/output port found on computers and has led to a
standardization method for the transfer of data between devices and a computer.
When a device is plugged into a computer using one of the USB ports:
- Computer automatically detects that a device is present (this is due to a small
change in the voltage on the data signal wires in the USB cable).
- The device is automatically recognised, and the appropriate device driver software is
loaded up so that the computer and device can communicate effectively
- If this is not available, the user is prompted to download the appropriate driver
software
This means it was WAY easier for you to use stuff cause you didn't need to install any
software and could just “plug and play”
USB-C
- A new type of USB connector, referred to as USB-C, is now becoming more common
in laptops and tablets/phone .
- This is a 24-pin symmetrical connector which means it will fit into a USB-C port either
way round.
- It is much smaller and thinner than older USB connectors, offers 100 watt (20 volt)
power connectivity, which means full-sized devices can now be charged and it can
carry data at 10 gigabits per second (10 Gbps); this means it can now support 4K
video delivery.
Advantages and disadvantages of USB
1. Interference (all types of cable can suffer from electrical interference, which can
cause data to be corrupted or even lost)
2. Problems during packet switching (this can lead to data loss – or it is even possible
to gain data!)
3. Skewing of data (this occurs during parallel data transmission and can cause data
corruption if the bits arrive out of synchronization)
Parity Checks
- Parity checking is one method used to check whether data has been changed or
corrupted following data transmission. This method is based on the number of 1-bits
in a byte of data.
- One of the bits in the byte (usually the most significant bit or left-most bit) is reserved
for a parity bit.
Checksum
Echocheck
- Upon receiving a message, the receiver will immediately send a copy back to the
sender.
- A comparison will then be carried out.
- If there is no difference between the two sets of data during the echo check, this
means that no error has occurred.
- Otherwise, an error has occurred and the data will be retransmitted.
This isn’t very reliable. If the two sets of data are different, it isn’t known whether the error
occurred when sending the data in the first place, or if the error occurred when sending the
data back for checking.
Process
- The receiving device receives an error detection code as part of the data
transmission. This is used to detect whether the received data contains any
transmission error.
- If no error is detected, a positive acknowledgement is sent back to the sending
device.
- If an error is detected, the receiving device now sends a negative acknowledgement
to the sending device and requests re-transmission of the data.
- A time-out is used by the sending device by waiting a predetermined amount of time.
If no acknowledgement of any type has been received by the sending device within
this time limit, it automatically re-sends the data until a positive acknowledgement is
received. Or until a predetermined number of re-transmissions has taken place.
Check Digit
- The error detection systems described above help to spot errors during the
transmission of data between two different devices. Sometimes, data discrepancies
can occur due to human input errors.
- An incorrect digit entered, for example 5327 entered instead of 5307
- Transposition errors where two numbers have changed order, for example 5037
instead of 5307
- Omitted or extra digits, for example 537 instead of 5307 or 53107 instead of 5307
- Phonetic errors, for example 13 (thirteen), instead of 30 (thirty).
Encryption
Encryption is when you mask your data so that only the intended recipient can read it.
Note: Encryption does NOT stop hackers from intercepting your message, it only stops them
from making sense of the message
How it works
Asymmetric encryption
The only thing we need to know for exam is
There is a public key, which all have
And there is a private key which is unique to one person and impossible to share
You need both to access a message