You are on page 1of 26

Monday, 3 October 2022

Data Representation Revision Notes


Converting Binary to Denary
• Use a conversion table to convert binary to denary
• Let’s take the binary number 00110101
128 64 32 16 8 4 2 1

0 0 1 1 0 1 0 1

• Add up the numbers which have 1 in their column


• (Calculators not allowed)
• 32+16+4+1=32+21=53 : 00110101=53

Adding Binary
• There are a few rules when it comes to adding binary
• 1+0=1
• 1 + 1 = 0, carry 1
• 1 + 1 + 1 = 1, carry 1
• Overflow error: When 2 binary numbers are added,
sometimes you end up with an extra digit which cannot t
in the register. The computer just ignores the extra digit at
the beginning, causing an overflow error.

Converting Binary to Hexadecimal and vice


versa
• Binary to Hexadecimal:
- Split the binary number into nibbles (from right to left)
fi
- If the number has extra bits, add 0s to the end, for
example 1111010001 becomes 0011.1101.0001
- Convert each nibble separately to denary (and as a result
hexadecimal) using a conversion table
- Convert any numbers higher than 10 to their letter
equivalent

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.
Benefits of Hexadecimal Numbers in
Computer Science
• Compact
• Easy to read and understand
• Less likely to make an error
• Easy to convert to binary
• Can be used to display colours (RGB colour model)
• MAC address
• Error codes
• ASCII

Character Sets
• Character: A symbol present on a keyboard
• Has a speci c character code consisting of numbers
• Character set: A complete set of all the characters
• Different languages represented using character sets
• Some character sets are: ASCII, Extended ASCII and
Unicode

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
fi
Upper-case and lower-
52 characters
case letters
numbers (0-9) 10 characters
Punctuation, space
33 characters
and other symbols
Non-printable 32 characters
• Extended ASCII is an 8-bit character set, so it can encode
256 characters
• European languages can be represented in Extended
ASCII

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
fi
fi
• 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.
• Shifting to the right is equal to dividing a number by 2
• Shifting to the left is equal to multiplying a number by 2

Images
• Bitmap images are made of an organised grid of pixels
• They are made up of individual pixels that collectively
compose an image
• When bitmaps are enlarged or zoomed in, the pixels are
over-stretched and the image loses quality.
• The colour of each pixel in an image is stored as a binary
value. For a black-and-white image, the colour white is
represented using the binary value 1 and black is
represented using 0
• A vector image uses coordinates and geometrical shapes
such as lines and curves to de ne an image.
• Vector graphics are based on mathematical formulas that
de ne geometric primitives such as polygons, lines,
curves, circles and rectangles.
• Therefore, a vector image is more ef cient than a bitmap
image as it needn’t store a binary value for each pixel.
fi
fi
fi
fi
fi
• Vector images do not lose resolution when scaled
• Vector images are best for cartoon-like images while
bitmaps represent photo realistic elements better than
bitmaps

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:
fi
fi
fi
- Permanently deletes sound from the le
- Only removes sound outside the human hearing range
- 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
fi
fi
fi
fi
fi
- The receiver then calculates the checksum
- If it matches, there is no transmission error
• 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.
• Check digit
- An extra digit added to a number that is calculated from
existing digits in the number (rather like checksum)
- One form of check digit is the ISBN (International Standard
Book Number)
- We’ll go through an i example to explain this and we’ll
start by imagining you have been given the ISBN
6103977000193
- The table below shows the steps to get the nished
product (we’ll go through each row step by step)
fi
- Firstly, we line all digits except the last in the rst row of
the table as shown
- Second, we write the multipliers in the second row. The
multiplier pattern is just 1,3,1,3 repeated
- We then multiply the digits by the corresponding
multipliers
- The next step is to add all our new multiplied numbers up
- After this we round the sum DOWN (always down, never
up) to get a multiple of 10
- Subtract this rounded value from the previous sum to get
the check digit. In this case the check digit is 3 so the
value is correct

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,
fi
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

Hardware Revision Notes


Encryption
• Encryption: The scrambling of data so that it is no longer
in a readable format
• Cipher text: The encrypted data/message
• Plain text: The data/message before it is encrypted
fi
fi
• Key: A sequence of numbers or characters used with the
algorithm to encrypt or decrypt data

The CPU
• The CPU is responsible for all processing and calculations
within a computer
• It carries out instructions using Fetch-Decode-Execute
• Fetch: Next instruction and data are fetched from memory
• Decode: CPU translates the instructions into ones
understandable by it
• Execute: CPU executes the instructions in a logical
sequence, then repeats the process
• Steps of the fetch-decode-execute cycle:
- The PC contains the address for the next instruction to be
fetched
- The contents of the PC are copied to the MAR via the
address bus
- It is then copied to the MDR
- Then it is copied to the CIR
- The PC is incremented by 1 so the next instruction can be
fetched
- The current instruction is decoded and carried out
• The CPU is made up of 4 main components:
- Control unit: Controls and coordinates which instructions
are executed and when. Decodes instructions using an
instruction set. 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
• Microprocessor: A small electronic device that can
perform calculations and carry out instructions (similar to
a CPU) OR a CPU contained in an integrated circuit on a
single chip that is made up of millions of microscopic
transistors.

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.

• Because there are 3 inputs, there are 2^3 (8) possible


binary combinations
• Let’s look at how to draw a logic circuit from a logic
statement using an example question I did in class.
1. Read the logic statement. This one is X=1 if ((A is 1 AND
B is 1) OR (A is NOT 1 AND C is 1))
2. Split the statement into 3 blocks: (A is 1 AND B is 1), OR
& (A is NOT 1 AND C is 1)
3. Analyse each block separately. We can start with the OR
since it is the easiest to analyse: it simply means the
logic circuit will end with an OR gate.
4. Now we can analyse (A is 1 AND B is 1). This means A
and B are both connected by an AND gate.
5. (A is NOT 1 AND C is 1) is slightly more complicated. A
and C are both connected by an AND gate. However,
before reaching the AND gate, A goes through a NOT
gate.
6. Draw in all the circuits. They should look similar to mine
above.
7. A good way to check if your circuit works is to input the
values in the logic statement and see if they match.
• However, we can also write logic statements when given
a logic circuit. We will use another example.
1. Let’s split the circuit into blocks, similar to what we did
with the logic statement. Of course, the circuit will
always start X=1 if…
2. A and B are connected by an OR gate. Therefore one of
our blocks will be (A is 1 OR B is 1)
3. B and C are connected by another OR gate, but C rst
passes through a NOT gate. Our next block will then be
(B is 1 OR C is NOT 1).
4. Both blocks seem to be connected by an AND gate at the
end. Therefore the nal statement should be X=1 if ((A is
1 OR B is 1) AND (B is 1 OR C is NOT 1)), or something
similar. As you can see, I did not write it exactly like this.
5. Like before, a great way to check your work is to input
the logic statement and see if it works.

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.

• However, you may also be asked to write a truth table for


a logic circuit. Here is an example question and its
answer.
fi
fi
• Solving it is pretty simple. You just put the given inputs
through all the gates until you get the nal output. Do this
for each row to complete the truth table.

Input Devices
• Input devices are devices that allow the user to input
information into a computer
• There are two types of input devices
• Automatic input devices
- Data transfer occurs automatically with minimal or no
human interaction
- Sensors
fi
A hardware device that will take measurements of
physical properties like temperature, pressure or acidity
Data is usually taken in in analogue form
Control systems can take control and alter how a process
is taking place
Monitoring systems do not make any changes to the
process; they simply report the information
- Barcode reader
Series of dark and light parallel lines of varying thickness
Numbers 0-9 each represented by a unique series of lines
Barcode scanner shines a light at the barcode
White lines reflect the light which is detected by sensors
in the barcode scanner
The bars give different binary values which are
interpreted by a microprocessor
Barcodes can store 30 digits
- QR code reader
QR stands for quick response
QR codes are made up of a matrix of lled-in squares on a
light background
Can store 7000 digits
Need internet access
Used for advertising products
Contains a website link or advertisement
A digital camera scans the QR code
The white squares reflect more light than the black ones
The squares at the corners are used for alignment
The code is converted to digital data
fi
The data is sent to the CPU and the website/ad is
displayed
- 2D scanners: scan head moves across the document until
the whole page has been scanned and an image has been
produced
- 3D scanner: Scans solid object and a 3D image
representing the object is produced
- Digital cameras
Have a microprocessor to automatically:
Adjust the shutter speed
Focus the image
Operate the flash
Adjust the aperture size
Adjust the size of the image
Remove ‘red eye’ when the flash has been used
• Manual input devices
- Pointing devices
Tracker balls have a ball on top which the user can move
with the palm of their hand, turning rollers inside which
allow the computer to interpret movement and move the
pointer on screen
Mechanical mice have a rubber ball to sense movement
and detect clicks using mechanical switches
Optical mice use an LED and a small camera to track
movement
- Keyboards: Hardware devices that allow users to input
letters or characters into the computer system
- Microphones
Hardware devices designed to input analogue sound
waves into the computer as digital signals
Sound wave is directed at the microphone
It will cause the diaphragm inside the microphone to
vibrate backwards and forwards
This causes a coil to vibrate which in turn changes the
magnetic eld produced by a magnet
Changes in the current are detected and a signal is output
- Touchscreens
Four types of touchscreen
Resistive
• Made with two layers, a top layer of polyester and a
bottom layer of glass
• When the top layer is touched, the two layers make
contact, completing a circuit
• The location of the touch is then calculated
• Possible to use while wearing gloves
• Cheaper technology than other touchscreen types
• Multi-touch is not possible
• Easily scratched
• Poor visibility in bright sunlight
Capacitive
• Made up of many layers of glass with a conductive layer
on top
• This creates an electric eld between the glass
• When a person touches the screen their nger will change
the electric current
• Coordinates of the current change are sent to a
microprocessor and the location of the touch is calculated
• Multi-touch is possible
• Very durable- a lot of force required to break glass
fi
fi
fi
• Gloves will not work as they are insulators and disrupt the
electric eld
Infrared touchscreen
• Create a grid pattern using LEDs and photocells
• LED lights shine constantly across the screen and into their
corresponding sensor
• When a nger touches the screen, it blocks the light and
the location of the touch is calculated
• Multi-touch is possible
• Bare ngers and stylus can be used
• Good screen durability
• Expensive
Surface Acoustic Wave screens (SAWs)
• Use a grid of sound waves
• Two sound wave transducers generate ultrasonic waves
and two receivers are used to receive the sound
• When the screen is touched, the sound wave is
interrupted and will not reach the receiver
• This info is sent to the microprocessor and used to
calculate the coordinates of the touch

Output Devices
• An output device is a piece of hardware that takes data
from within the computer and turns it into something a
human being
• Printer
- There are three types of printer
- Inkjet
fi
fi
fi
Works by spraying the ink through little nozzles onto
paper
Great for photos and image heavy documents: they do a
better job of blending smooth colours than laser printers
Low cost- cheaper than laser printers
Inkjet ink is expensive
Very slow compared to laser printers
Two methods to spray the ink
Thermal bubble
• Tiny resistors produce localized heat that vaporizes the ink
• The bubble of ink is ejected from the printer head onto the
paper
• When the bubble of ink collapses, a vacuum is created to
draw fresh ink from the print head
Piezoelectric
• A crystal at the back of the ink reservoir is given an
electric charge and a vibration is created
• The vibration forces the ink to be ejected onto the paper
- Laser
A laser printer uses dry powder ink rather than liquid ink
Uses static electricity to print
Prints the whole page in one go
Carries out large print jobs at a good speed and does not
run out of ink halfway
Faster than inkjet printers
Good at printing text, especially small fonts and ne lines
More expensive
Can’t handle heat-sensitive paper
fi
- 3D printers: Widely used in computer-aided design to
produce solid objects or various materials such as
powdered resin, powdered ceramic, etc.

Data Storage Revision Notes


Primary Storage
• Primary storage is directly accessed by the CPU
• There are two categories of primary storage: RAM and
ROM
• RAM (Random Access Memory):
- Used to store data and programs currently in use, such as
the operating system, the software in use and the data
which the software is using
- RAM is volatile memory, meaning that when the power is
lost, any data being stored on it is lost
• ROM (Read Only Memory):
- Cannot be written to; it simply holds data that can be read
- The data that ROM holds is the instructions that are
needed for a computer to start up when the power is
switched on
- These instructions are known as BIOS (Basic Input Output
System)
- ROM is non-volatile: it does not lose data when the power
is lost
• Differences between RAM and ROM:
- RAM is volatile while ROM is non-volatile
- RAM can be read and written to while ROM can only be
read
- RAM stores temporary data and programs while ROM is
permanent

Secondary Storage
• Secondary storage is long-term memory which stores
les and programs not in use
• The main forms of secondary storage are HDDs, SSDs and
optical storage
• Similarities between HDD and SSD:
- They are non-volatile
• Differences between HDD and SSD:
- SSDs use NAND chips to store data while HDDs use
magnetic properties
- HDDs use moving platters while SSDs use flash memory
- HDDs consume more power than SSDs
- HDDs are heavier than SSDs
- HDDs are less reliable than SSDs as moving parts could
break
- SSD is quieter than HDD as it has no moving parts
fi

You might also like