Computer Science Notes
Computer Science Notes
0 0 1 1 0 1 0 1
8 4 2 1
0 0 1 1
1 1 0 1
0 0 0 1
- 0011=2+1=3
- 1101=8+4+1=13=D
- 0001=1
- 1111010001=3D1
• Hexadecimal to binary:
- Split each character of hexadecimal. If necessary, convert
letters to numbers
- Convert each number to binary using a conversion table.
- AE6:
- A=10 10=1010
- E=14 14=1110
- 6=0110
- AE6=101011100110
• To convert hexadecimal to denary, simply convert it to
binary and convert the binary number to denary.
ASCII
• ASCII stands for American Standard Code for
Information Interchange
• ASCII is a 7-bit set of code which can represent 128
characters
• It can represent letters (both uppercase and lowercase),
digits, punctuation, special characters and control
characters
• Used for English only
Upper-case and lower-
52 characters
case letters
numbers (0-9) 10 characters
Punctuation, space
33 characters
and other symbols
Non-printable
32 characters
control codes
• Extended ASCII is an 8-bit character set, so it can encode
256 characters
• European languages can be represented in Extended
ASCII
fi
What is meant by a MAC Address?
• A MAC Address is a Media Access Control Address
• It refers to the number on the internet which uniquely
identi es a device on the internet
• It is made up of 48 bits, which is shown as a 6-group of
hexadecimal digits
• This address is written in the form NN-NN-NN-DD-DD-DD
where the N part is the identi cation number of the
manufacturer and the D part is the serial number of the
device
2s Complement
• Used to convert negative denary numbers
• Convert the number to binary
• Switch the 0s and 1s
• Add 1 at the end
• For example, -36
• 00100100
• 11011011
• 11011100=-36
Logical shifts
• Shifting Right: The Least Signi cant Bit (LSB) shifts to the
carry and the MSB is occupied by a zero.
• Shifting Left: The Most Signi cant Bit (MSB) shifts to the
carry and the LSB is occupied by a zero.
fi
fi
fi
fi
• Shifting to the right is equal to dividing a number by 2
• Shifting to the left is equal to multiplying a number by 2
Data Transmission Revision Notes
Methods of Transmission
• Serial:
- Data is sent one bit at a time along one channel.
- Slower than parallel
- Better over long distance
- Less interference and cheaper
- Asynchronous as only one channel is used
• Parallel:
- Data is sent multiple bits at a time over multiple channels
- Faster than serial
- Synchronous
Methods of synchronization
• Asynchronous:
- Data sent in groups with an agreed bit pattern
- Data combined with a start and stop bit
• Synchronous:
- Data sent as a stream of bits
- Synchronized by timing signals from an internal clock
Direction of Transmission
• Simplex:
- Data can be sent in one direction only
- Example: Radio
• Half-duplex:
- Data can be sent in both directions, but one at a time
- Example: Walkie-talkies
• Full-duplex:
- Data can be sent in both directions simultaneously
- Example: Mobile phone conversation
Image Compression
• Lossy Compression:
- A compression algorithm is used
- Permanently removes data from a le
- Tries to reconstruct the le without the missing data
- Each pixel has less bits
- Makes le smaller than lossless
- Drop in quality
• Lossless compression:
- Algorithms are used to spot patterns of similarly coloured
pixels
- Stores pattern as an instruction so image can be
reconstructed to its original quality
Sound Compression
• Lossy Compression:
- Permanently deletes sound from the le
- Only removes sound outside the human hearing range
fi
fi
fi
fi
- Not much of a drop in quality
- MP3 les are compressed using lossy and can be up to
90% smaller
• Lossless Compression:
- Compression algorithm is used to spot patches of similar
sound and state how many there are
- Stores it as an instruction so sound le can be
reconstructed to its original quality
- Uses MIDI (Musical Instrument Digital Interface) to store
pattern as an instruction
Bene ts of sending compressed les over the internet:
Faster
Takes up less storage space
Cheaper
Error Checking
• Parity Checking
- A parity bit is attached to the end of each block of data
- It can have even or odd parity
- The receiver performs a check to make sure it matches
the parity of the system
- If it does not, there has been an error in transmission
• Checksum
- A value called checksum is attached to the end of a block
of data
• The sender calculates the checksum
- The receiver then calculates the checksum
- If it matches, there is no transmission error
fi
fi
fi
fi
• ARQ
- ACKNOWLEDGEMENT and TIMEOUT are used
- ACKNOWLEDGEMENT is a message sent by the receiver
to the sender indicating that the data has been received
correctly.
- TIMEOUT is the time allowed to elapse before an
acknowledgement is received.
- If the ACKNOWLEDGEMENT is not received within the
TIMEOUT, the message is automatically resent.
Data Packets
• Data must be broken down into packets to be transmitted
• A packet contains:
- Packet header: This includes-
A. The sender and recipient’s IP address,
B. The packet number,
C. The total number of packets the message contains and
D. The details of any protocols used
- Payload: The actual message itself
- Trailer: Usually contains a couple of bits that will tell the
receiving device that it has reached the end of the packet
• Process of packet switching:
- Data is broken down into packets
- A router controls the route each packet takes
- Once the last packet has arrived, packets are reordered
USB
• USB: Universal serial bus
• It has 4 pins to connect wires, 2 which carry the power
and ground connection and 2 which transmit data
• Bene ts of using USBs:
- Industry standard
- Supports multiple transmission speeds
- Devices are automatically detected and con gured when
attached
The CPU
• The CPU carries out instructions using Fetch-Decode-
Execute
• Fetch: Next instruction and data are fetched from memory
fi
fi
• Decode: CPU translates the instructions into ones
understandable by it
• Execute: CPU executes the instructions in a logical
sequence, then repeats the process
• The CPU is made up of 4 main components:
- Control unit: Controls and coordinates which instructions
are executed and when. Contains Current Instruction
Register (CIR) which contains the instruction being
executed and the Program Counter (PC) which contains
the address of the next instruction.
- Arithmetic and Logical Unit (ALU): Responsible for all
mathematics and calculations performed by the CPU. Can
perform the following calculations:
A. Addition
B. Subtraction
C. Multiplication
D. Division
E. Logical comparisons (Is A=B, Is 3>5): The ALU can
increase the complexity of these logical comparisons by
adding boolean operators ‘And’, ‘Or’ and ‘Not’ (Is A<B Or
C<A).
- Program counter: Stores the address in memory of the
next instruction to be executed
- General Purpose Register (GPR): Notepad of the CPU. If
the ALU needs to temporarily store data as part of its
calculations, it is stored here.
Computer Architecture
• Buses: A bus is a set of parallel wires that connect two or
more components within a computer system
• Address bus:
- Carries signals that relate to addresses
- Between the processor and memory
- Uni-directional
• Control bus:
- Carries signals that relate to control
- For example, an instruction to read data
- Can be uni-directional or bi-directional
• Data bus:
- Carries actual data
- Between components and devices
- Bi-directional
Logic Gates
• NOT gate:
- Has only 1 input
- The output is the opposite of the input
• AND gate:
- If either of its inputs is 0, the output is 0
- It needs both inputs to be 1 for the output to be 1
• OR gate:
- If either of the inputs is 1, the output is 1
- Both of the inputs need to be 0 for the output to be 0
• NOR gate:
- If both of its inputs are 0, the output will be 1
- If either of its inputs are 1, the output will be 0
• NAND gate:
- If both of its inputs are 1, the output will be 0
- If either of its inputs are 0, the output will be 1
• XOR gate:
- If both of its inputs are different, the output will be 1
- If both of its inputs are the same, the output will be 0
Logic Circuits and Logic Statements
• Logic circuits are combinations of logic gates. Here is an
example.
Truth Tables
• Truth tables are tables which show all possible inputs and
outputs of a logic gate or circuit.
• They come in varying levels of complexity. For example,
here is a simple truth table for the OR gate.
fi
fi
• However, you may also be asked to write a truth table for
a logic circuit. Here is an example question and its
answer.