Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
50 views

Computer Science Notes

The document discusses computers and their basic components and functions. It covers topics like binary, storage, computer languages, and computational thinking. Examples of early computers and their parts are also explained.

Uploaded by

monke0xd
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
50 views

Computer Science Notes

The document discusses computers and their basic components and functions. It covers topics like binary, storage, computer languages, and computational thinking. Examples of early computers and their parts are also explained.

Uploaded by

monke0xd
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 23

What Are Computers?

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

Computer: a machine thats job is to store, processes and present data


All computers have the following
● Inputs
● Outputs
● Processing
● Storage
Examples of computers
● Ipad
● Laptop

What is representation?

What were early stories important?


They were a form of entertainment and also lessons
What forms did they take?
Oral or occasionally written

● Computers only understand data and instructions


● Eg.12x5 12 and 5 are the data and x is the instruction

Lightbulbs

1=2 on/off

2=4 on/on off/onn off/off on/off

Homework

3= 8 off/off/off off/off/on off/on/off off/on/on on/off/off on/off/on on/on/off on/on/on

4=16

x=2x
10=1024/210

Binary System
- The binary system is used because computers only understand yes and no’/1and0

If needed you can also use a table such as this

8 4 2 1

1 0 1 1
(1x8)+(0x4)+(1x2)+(1x1)=11

Denary= normal human numbers

Denary number 5
Divided by 5

2 2 remainder 1

2 1 remainder 0

2 0 remainder 1

=101(read bottom to top)


Denary number 39
Divided by 39

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

To calculate put binary in groups of 4 like so

And convert them into denary(only numbers above 10 are letters)


10/0001/1111/1101
=21FD
If less than 4, include 0’s at the end

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

Denary number 3179


Divided by 3971

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

073 32 104 97 118 101 32 49 50 32 97 112 112 108 101 115

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)

Bring No Bright Knights Made Grown To Perfection

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.

Program Development cycle


Analysis: breakdown the problem into sub-problems via decomposition
Design: Using flow charts and pseudocode
Coding: Make the code
Testing: testing Individual parts to check for problems
Analysis: analyze mistakes, improve
Flowchart
Structure diagram

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

Input and output


Input: Used for data entry; it is usually followed by a variable where the data input is stored,
must be capitalized
Output: Used to display information on a screen or a sound from a speaker, must be
capitalized
Conditional statement
Allows the algorithm to do different things depending on the input/scenario
Iterative statement
Allows for repeats
Translators
Humans are much better at understanding instructions, as they can infer, whereas
computers need exact precise language

Assembler: A translator which translates whatever we write in English/computer language to


binary code

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.

Initializing: a variable means setting the initial value.

A variable must initialized before it can be used

Once a variable has been initialized with its first value, it can then be reassigned a new value
throughout the execution of the code.

Python naming lexicon


Variables must always be (In python snake case)
- Lowercase
- Use _ instead of space
-
Print = print in terminal
F string = look for whatever the valuable in {} is and put that instead of just printing the
variable
{} = when in an f string, replaces the variable with the value
Reassigned = Changing a variable
Input = data in a program
Input = whatever is inputted
String = a string of text that can be anything from numbers to letters to punctuation, always
has quotation marks on the outside eg. “Hello World!”
Integer = Defined via INT(), is a whole number eg. 1
Boolean = Only has 2 outcomes e. True, False
Real/Floats = Decimal numbers eg. 2.8
Char = a single character eg. E
int(input()) = Same as input, but it only accepts integers
str(input()) = Same as input, but it only accepts string
except ValueError =

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

Number <- INPUT “Input a number”


OUTPUT f”suck {number} lolipop”
Data transmission
Packet structure
- Data sent over long distances is usually broken up into data packets
- Packet size is roughly 64KiB(kibibytes)
- This makes it easier to control than a long continuous stream of data.
- Each Packet can be sent along a different route to its destination.

Disadvantages
- Packets must we reassembled in the right order as they will arrive randomly
- Packets may sometimes go missing(data packet error)

Packet structure (3 parts)


- Header
- Payload
- Trailer

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

*step 3 refers to the route with shortest possible processing time


Benefits of packet switching
There is no need to tie up a single communication line.
A high data transmission rate is possible
Drawbacks of packet switching
Data can be lost and need to be re-sent
Delay at the destination whilst the packets are being re-ordered
Types of data transmission
Serial

Parallel

Advantages and Disadvantages of each


Transmission Modes
Simplex
- Simplex mode occurs when data can be sent in ONE DIRECTION ONLY (for
example, from sender to receiver).
- Example: Computer sending a message to a printer
Half-duplex
- Half-duplex mode occurs when data is sent in BOTH DIRECTIONS but NOT AT THE
SAME TIME (like only one person can send data at a time, the other must wait their
turn).
- Example: Walkie talkies
Full-duplex
- Full-duplex mode occurs when data can be sent in BOTH DIRECTIONS AT THE
SAME TIME (for example, data can be sent from ‘A’ to ‘B’ and from ‘B’ to ‘A’ along
the same transmission line simultaneously).
- Example: The broadband internet
Advantages and Disadvantages of each
Universal Serial Bus(USB)
Universal serial bus is a form of SERIAL data transmission.

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.

USB allows both half-duplex and full-duplex data transmission.

The USB cable consists of a four-wire shielded cable, with


- two wires for power (red and black)
- Red: Power(has its own supply)
- Black: Ground(keeps current flowing)
- two wires (white and green) are for data transmission.

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

Advantage 1: Backwards compatibility


Advantage 2: Can supply power and data

Question 2: serial or half duplex/full duplex


Methods of error detection
When data is transmitted, there is always a risk that it may be corrupted, lost or even gained.

Errors can occur during data transmission due to:

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)

The five holy error detection methods


- Parity checks
- Echo check
- Check digit
- Checksum
- Automatic repeat request

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.

- The parity check can be either called EVEN and ODD

- 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.

Automatic Repeat Request

ARQ uses positive and negative acknowledgements and timeout.

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

1. Starts as plain, human text


2. Get converted to cipher text with an encryption algorithm, making it unreadable by all
except those with a decryption algorithm
3. Recipient receives cipher text, and uses a decryption algorithm to revert the
ciphertext to plaintext

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

You might also like