Computer Science Notes
Computer Science Notes
Binary System
- Binary number is not showing: 0
- On: 1
- Off:0
Number system
- 4 types: Binary, Decimal, octal and Hexadecimal number systems
- 10 digits: 1, 2, 3, 4, 5, 6, 7, 8, 9, 0
- Only a 10 digit number can be made without repeating any of the digits
1
Converting from Binary to Denary
OR
2
- 1 bit- 0 or single
- 4 bit- nibble
- 8 bit- 1 byte
- Pattern: 1st row on left has 8 zeros then 8 ones, then the 2nd row from the left
has 4 zeros and 4 ones, 3rd row from left has 2 zeros and 2 ones, last row from
left has 1 zero and 1 one
3
- If its an odd number, add 0 to the left so 1 0001 0111 becomes 0001
0001 0111
Hexadecimal to Binary
4
Hexadecimal to denary
Denary to Hexadecimal
5
Measurement of the size of computer memories
- A binary digit is commonly referred to as a BIT
- Some computers use larger bytes but they are always multiples of 8. For examine: 16- bit
systems and 32-bit systems
Binary Addition
- Rules
• 0+0=0
• 0+1=1
• 1+0=1
6
Overflow Errors
- If the addition of the leftmost bits (the bits in the column with place value) produces a
carry, then the result will exceed the available number of bits. This is called an overflow
error
Usage of hexadecimal
- Colour codes
- MAC Address
- Error codes
- IPv6 addresses
MAC Address
- A number which uniquely identifies a device on the Internet.
• They are easier and faster to work with, taking up less space
7
ASCII (American Standard Code for Information Interchange)
- Uses 8 bits to store each character
- 8 bit is used as a check bit so only 7 but is available to store each character
- To increase the ASCII value without looking at the table, get the difference,
convert it into binary and add/subtract it.
- OR take the value, covert binary to denary, subtract/ add the difference (deanery),
convert to binary again, thats the ASCII key
8
- *when counting ASCII characters, count the enter key and the space key as
well
UNICODE
- Unicode Transformation Formats (UTF)
- UNICODE supports ALL languages in the world (all characters symbols, etc)
Logic Gates
- The transistors can be built into circuit called logic gates
- They can take one or more inputs and either produce an output or not according
to the way they have been wired up
Numbers
- Signed and Unsigned
- Signed:
9
• The left most bit will be the sign (Positive:0, negative:1)
Number Extension
1. Sign goes on extreme left
10
1’s complement
- Positive numbers:
• same as signed magnitude.
- Negative numbers:
1. - becomes + (Left most bit doesn’t change in answer)
11
2’s complement
- 15 combinations because +0 and -0 is same
- Positive numbers:
• Have the same value as the signed magnitude and 1’s complement
- Negative
numbers:
• Take 1’s
complement
• Inverse
• Add 1
12
https://www.exploringbinary.com/twos-complement-converter/
13
14
Sounds
- Analogue waves: constantly changing. For example: the sound coming out of
your mouth right now, smooth,
- Digital sounds: used by computers and most of the music today, discrete signals,
complex series of ‘on and off instructions, square and discrete
- Takes measurements of the sound based on the number of bits used to record
each measurement, as the number go bits increase, the accuracy increases as
well. This is also called sample resolution
- The computer system will take a sample of the analogue wave a specified
number of times every second (sample rate), and record each measurement using
a predetermined number of bits (sample resolution).
- The sample rate affects the detail in the digital sample because the more times
an analogue wave is sampled, the more data is gathered.
- The closer the digital sample is to the analogue sound wave, the clearer and more
detailed it will be.
- There are two ways in which a computer system can improve audio quality:
If both of these are increased, the computer system will store more data, and thus
the file containing the audio will be much larger.
The higher the sample rate, and the higher the sample resolution, the more detailed
the sound will be, but the file used to save the sound will be much larger.
15
Images
- A pixel – a picture element – is the smallest identifiable piece of an image.
- Each pixel in an image is given a binary number which relates to a specific colour.
- Image resolution refers to the number of pixels within an image, and this is
normally described using the width and height of the image.
- For example, a resolution of 1080 × 720 means that an image is 1080 pixels wide
and 720 pixels high.
- If we increase the bit depth – the number of bits per pixel – we can achieve more
colour combinations:
- The resolution of an image is the number of pixels in the width × the height of the
image.
- The bit depth of the image refers to how many bits are used to store the colours
in each pixel of the image.
- The higher the bit depth, and the higher the resolution, the more data has to be
stored. This means the file will be larger, but with a clearer and more vivid image.
16
Data Storage
- In the form of bits
- The size of a mono sound file: sample rate (in Hz) X sample resolution (in bits) X
length of sample (in secs)
17
Lossy Compression
- There is some loss of data
- Some unnecessary bits are reduced from the information to reduce file size
- We cannot get back the original film once it has been compressed
Loseless Compression
- It checks for the pattern in the file
- No loss of data
- If there is no pattern in the file, the file size may increase as the algorithm makes
its own pattern
Cannot get the original file back Can get the original file back by regenerating
Removes bits for compression Checks for patterns and groups similar data
together for compress
Reduces file size by a lot Reduces file size less than lossy
18
- Lossless technique is better in most ways
Logic Gates
- An idealised model of computation or physical electronic devices implementing a
boolean function, a logical operation performed on one or more binary inputs that
produces a single binary output
- Output is always 1
- NOT gate
- Only not gate has one input and one output (only 2 combinations). All other gates
have two inputs and one output
- AND gate
- AND is represented by .
- OR gate
- OR operation is represented by + sign
- OR gate is addition
19
- NOR gate
- Combination of AND and OR gate
- Both are false, output will be true (any other combinations is false)
- NAND gate
- Combination of AND and NOT gate
- All other conditions either one is true/false or both are false, answer will be true
- XOR gate
- NOT, AND and OR gate
- Only when one is true and one is false, answer will be true
20
Truth Tables
- To trace the output from a logic gate
https://bit-calculator.com/bit-shift-calculator
https://onlinetoolz.net/
bitshift#base=10&value=-12&bits=8&steps=2&dir=l&type=log&allsteps=1
https://www.exploringbinary.com/twos-complement-converter/
Softwares
- A program that allows a person to complete a task
System software
- Operating system, Utility softwares, Disk Drivers, Linkers
- Programs that allow the hardware to run properly and allow the user to
communicate with the computer
- Disk Drivers are programs that make the system aware of the hardware it needs
to communicate with. For ex: a printer driver needs to be installed before printing
21
- Disk Drivers are softwares that enable one or more hardware devices to
communicate with the computers operating system
- Linkers provide an object file that allow the user to combine softwares for
example: Word with Excel
- Linker is a computer program that takes one or more object files produced by a
compiler and combines them into a single program which can be run on a
computer
- Utility Softwares are programs that help to manage, maintain and control
computer resources. For example: AntiVirus software
Application Softwares
- Word Processors (MS Word), Video Editing Softwares (iMovie), Spread Sheets
(Excel), Database (MS Access, SQL), Photo Editing softwares (Adobe
Photoshop), Control and Measuring Softwares (Measure), Graphics Softwares
and Apps etc
https://computer.howstuffworks.com/operating-system2.htm
22